MrExcel Publishing
Your One Stop for Excel Tips & Solutions

using a variable instead of [-1] in .formulaR1C1


Posted by Andreas on June 25, 2001 1:43 AM

Is there a way to use a variable instead of a fixed number in:

ActiveCell.FormulaR1C1 = "=SUM(R[-1937]C:R[-1]C)"


Posted by Ivan F Moala on June 25, 2001 2:41 AM

Something like;

Dim A As Double
Dim B As Double

A = -1937: B = -1
ActiveCell.FormulaR1C1 = "=SUM(R[" & A & "]C:R[" & B & "]C)"


HTH

Ivan