including blanks or text values in macro-entered formulas

  • Thread starter Thread starter Matthew McManus
  • Start date Start date
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
 
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"")"
 
Thanks for that - I thought that there had to be a simple solution
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top