PDA

View Full Version : Cells(1, 3).Formula = "=IF(B1>0;A1;B1)" -- Error 400


MagicBuzz
08-21-03, 06:10
When I type this very simple instruction, I get a blank popup indicating "400".

Cells(1, 3).Formula = "=IF(B1>0;A1;B1)"

I found on MSDN this error code indicates the form is already active and can't be modal... But I don't have form !

How do to this work ?

When I try :

Cells(1, 3).Formula = "=SUM(A1:B1)"

I don't have any problem.

Excel 2000

MagicBuzz
08-21-03, 07:31
OK... Amazing...

I found the solution, Excel is simply crazy.

When we type a formula in a cell, it replaces the "," parameter separator with ";".

BUT when we type the value from VBA, it must be ","...
So :

Cells(1, 3).Formula = "=IF(B1>0,A1,B1)"

It works