Formula/Text?
you can't assign anything to the text property of a range - it is read only
ActiveCell.FormulaR1C1 = "=SUM(R[" & x & "]C:R[" & y & "]C)"
rather than use Trim(str(number)) to get rid of the space put in by str, use
cstr(number) or just number and let vba do the conversion.
lngNum = 200
"number " & lngNum & " greater than 3"
Formula expects A1 style addressing
FormulaR1C1 expects R1C1 style addressing
--
Regards,
Tom Ogilvy
"David Fixemer" wrote in message
...
I've seen several past postings that imply formulas should
be entered as text ("=sum(A" + trim(str(firstrow))
+":A"+trim(str(lastrow))+")"
that activecell.text = . . .
is the same as activecell.formulaR1C1 = . . .
However, the following lines of code makes me believe this
is not exactly correct?
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
ActiveCell.FormulaR1C1 = "=SUM(R1C:R3C)"
How would I use variables instead of numbers and/or
offsets?
x=1
y=3
ActiveCell.FromulaR1C1 = "=SUM(RxC:RyC)"
Thanks for any/all assistance,
David Fixemer
|