View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Sum using Variable

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


"Fatz" wrote:

Hi-

The following code will sum the 14 rows above the row I am in. I want
to replace the -14 below with a variable (i). How do I code the below
to work with a variable?

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

Thank You!

Chris