View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default translating formulas

Also, look at this thread http://tinyurl.com/5v7mz where we discussed this
with you before.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Luc Benninger" wrote in message
...
I am using the code below to translate worksheet formulas to the locale
language. For some formulas this works fine (e.g. SUM), but for others
it doesn't (e.g. MOD). Can anybody explain me why?? Using Excel XP.
Thanks for any responses.
Luc

********* start of sample code ******************

Public Sub Test_Successful()
ActiveSheet.Range("A1").Formula = TranslateFunction("=SUM(B1:B2)")
End Sub

Public Sub Test_Fails()
ActiveSheet.Range("A1").Formula = Translate("=MOD(ROW(),2)=0")
End Sub

Private Function Translate(funcUS As Variant, Optional wb As Workbook)
As Variant
Dim sheet As Worksheet
If wb Is Nothing Then
Set wb = ActiveWorkbook
End If
Set sheet = wb.Sheets.Add
sheet.Visible = False
sheet.Range("A1").Formula = funcUS
TranslateFunction = sheet.Range("A1").FormulaLocal
Application.DisplayAlerts = False
sheet.Delete
Application.DisplayAlerts = True
Set sheet = Nothing
End Function