including blanks or text values in macro-entered formulas

M

Matthew McManus

When I try to use the following codes, I get error messages. How do
get around the problem?

Cells(2,2).Select
ActiveCell.Formula = "=if(A1=1,"",1)"

or

Cells(2,2).Select
ActiveCell.Formula = "=if(A1=1,"High","Low")"

Thanks so much for any assistance

Matthe
 
J

JE McGimpsey

Just as in XL, quotation marks within a string need to be doubled (or
use CHR(34)):


ActiveCell.Formula = "=IF(A1=1,"""",1)"

and

ActiveCell.Formula = "=IF(A1=1,""High"",""Low"")"
 
Top