PDA

View Full Version : ActiveCell.Value = sum formula, how to?



next
02-20-2008, 10:43 AM
i = column number.
LastCell = Row on which calculation should be performed.
I'm trying to insert a sum formula in each row from 3 to 12.
Sum should calculate all values above it up to second row.
For instance first loop:
Cells(column 3, Row 65).Value.FormulaR1C1 = "=SUM(everything in third column from row 2 to row 64)".
Please help:

For i = 3 To 12
Cells(i, LastCell).Value.FormulaR1C1 = "=SUM(?)"
Next i


Thanks!

Bob Phillips
02-20-2008, 10:53 AM
I might have the wrong column here



For i = 3 To 12
Cells(i, LastCell).FormulaR1C1 = "=SUM(R2C:R[-1]C)"
Next i

mdmackillop
02-20-2008, 11:00 AM
"=SUM(R2C1:R[-1]C1)" to sum from column 1 , XLD's will sum the same column as the formula.

next
02-20-2008, 11:22 AM
Thanks, that worked perfectly!