Posted to microsoft.public.excel.programming
|
|
cell formula in string variable doesnt work
Thanks!
using Range("A1").Formula worked with the added """" in there. Thanks again!
"Bernard Liengme" wrote:
James:
a) the " " messing thing up; you need """" -- a quote before a quote to
indicate the second one is be be taken literally and not as a delimiter
b) you are not using R1C1 notation
c) no need to use Select
Sub tryme()
Y1 = "=IF($D24=0,"""",$D24-$I$4*TAN(RADIANS(L10)/2))"
Y2 = "=IF($D24=0,"""",$D24-$I$4*2*TAN(RADIANS(L10)/2))"
Range("J10").Formula = Y1
Range("J11").Formula = Y2
End Sub
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email
"James" wrote in message
...
I have:
Y1 = "=IF($D24=0,"",$D24-$I$4*TAN(RADIANS(L10)/2))"
Y2 = "=IF($D24=0,"",$D24-$I$4*2*TAN(RADIANS(L10)/2))"
then try and use:
Range("J10").Select
ActiveCell.FormulaR1C1 = Y1
Range("J11").Select
ActiveCell.FormulaR1C1 = Y2
Why doesnt this work?
|