ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   To include quote marks in selection.formula (https://www.excelbanter.com/excel-programming/371147-include-quote-marks-selection-formula.html)

Ben

To include quote marks in selection.formula
 
Selection.Formula = "=IF(G4="C",L4-F4,0)"

I would like the above formula to be input in the active cell. The trouble
is that the appearance of the quote marks around C produces a syntax error in
VBA. How do I include quote marks in a formula that Ineed to input using VBA.
Thank you

leonidas[_80_]

To include quote marks in selection.formula
 

Hi Ben,

Try:
Selection.Formula = "=IF(G4=""C"",L4-F4,0)"

That should do the trick!

Good luck!


Leonidas


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=574256



All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com