View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Issue regarding Regional settings


While this doesn't answer your regional setting question, why would you want
to put the *value* in B1 in your formula's comparison... wouldn't you want
B1 itself to go there? Putting the regional setting aside, I would think
your formula assignment should be this...

Cells(1, 1).Formula = =IF(B1=0,0,5)

or, if your arguments to Cells(1,2) are really variables, then this...

Cells(1, 1).Formula = "=IF(" & Cells(R, C).Address & "=0,0,5)

where you can use the optional arguments of the Address property to set the
relative/absolute row/column references.

--
Rick (MVP - Excel)


"T.Mad" wrote in message
...
Hi there,
I am programming in VBA having set up the Greek Regional settings. This
means that in Greece we use , instead of . for decimals and .
instead
of , for thousands. I had to pass an excel formula via VBA which is:

Dim num as Double

Num=Cells(1,2).value this number is 10.1 (10,1 with Greek symbols)
Cells(1,1).formula = =if( & num & =0,0,5)

and I got an error message. I also used this formula:

Cells(1,1).formula = =if( & num & =0;0;5)

Which is the exact way to input the IF function (;) to Excel with Greek
regional settings but again I got this error. Can anybody give me a good
piece of advice?
Many Thanks