A technique that I routinely use is to turn on the macro recorder and
enter the formula in a cell. Turn off the recorder and XL will give
you the correct VBA code! :)
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article , "=?
Utf-8?B?Um9uIE1jQ29ybWljaw==?="
says...
I am trying to write the appropriate code to enter a formula along the
following lines into a particular cell in a worksheet.
=IF(Range1= "",Range2, Range1)
I've been advised that I should use coded version of the quotes
incorporating Chr (34) - something like:
strQuote = Chr(34)
ActiveCell.Formula = "=IF(Range1= "& Chr(34) &" ,Range2,Range1)"
but I can't seem to get the syntax quite right.
Any help would be appreciated.