View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Inserting a formual with " in it

Hi Mike,

Try doubling the internal quotes:

ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)"


---
Regards,
Norman


"Mbt6" wrote in message
. ..
I want to insert a formula into a specific cell, something like

ActiveCell.FormulaR1C1 = "=EOMONTH (Now(), -1)"

This works fine and gives me the last day of last month.

But this doesn't work because of the "

ActiveCell.FormulaR1C1 = "=Right("0000"&c3,4)"

The formula has quotes in it, and the VB chokes as it expects only one set
of quotes.

--mike