1

There is some way to type internationalized formulas on excel macros??

Right now im doing some like this:

If (languageCode = 1033) Then
  'type formula in english
  sheet.cell(r,c).Value = "=IF(A1=B1, "i18n", "#error")"
Else
  'type formula in another language
  sheet.cell(r,c).Value = "=SE(A1=B1, "i18n", "#erro")"
End If

Im using this logic because the client's excel is in a different language than mine, but the formula is realy big, and there are many other languages to cover.. so im not liking the way it going. :( I did some reseacrh but with no satisfactory answers.

This is my very first question so, sorry if I made some typo or format mistake.

jSpeciale
  • 47
  • 8
  • Are you asking for a self-translating formula? I do not think there is any way to do this... – David Zemens May 15 '14 at 14:30
  • 1
    I think Excel should translate if you use `.Formula` instead of `.Value` – z̫͋ May 15 '14 at 14:47
  • See http://stackoverflow.com/questions/8588728/excel-2010-vba-find-the-current-user-language - the Excel language may differ from Windows. – brettdj May 16 '14 at 01:19

1 Answers1

1

Accorcing to this article vba works internally with English, and Excel translates to the destination language at runtime. You should be able to do this with the formula property of the cell instead of the .value.

sheet.cell(r,c).Formula = "=IF(A1=B1, "i18n", "#error")"

See also Internationally Valid Excel Formula.

Community
  • 1
  • 1
RubberDuck
  • 11,933
  • 4
  • 50
  • 95
  • 1
    In addition, it is possible to see or set the local language version of the formula using the `FormulaLocal` property. – MP24 May 15 '14 at 19:54