Quoting within a string

  • Thread starter Thread starter Paula
  • Start date Start date
P

Paula

Hello everyone,

How do I go about using double quotes within a string...I need to make the following line valid in VBA:
Me.Range("Total_Year_5").Formula =
"=IF(Period>4,IF(Growth_Rate>0,IF(Total_Year_1>0,(Total_Year_4*(1+Growth_Rate)),0),Total_Year_1),"N/A")"

The last part ("N/A") causes the VBA error in the IDE.

Thank you for any advice you can give me.

Paula Barrett
 
Hi
try
Me.Range("Total_Year_5").Formula =
"=IF(Period>4,IF(Growth_Rate>0,IF(Total_Year_1>0,(Total_Year_4*(1+Growt
h_Rate)),0),Total_Year_1),""N/A"")"


--
Regards
Frank Kabel
Frankfurt, Germany
Paula said:
Hello everyone,

How do I go about using double quotes within a string...I need to
make the following line valid in VBA:
 
Hi Paula

Here is a very handy tip. When/if you need to add a formula to a cell
via VBA, simply add the formula as needed to any cell manually. Then
select the cell, and go to Tools>Macro>Record new macro now simply push
f2(to enter edit mode) now push Enter and stop recording. Now pinch the
needed code.

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Back
Top