ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum Function in Macro (https://www.excelbanter.com/excel-programming/278200-sum-function-macro.html)

Tim[_23_]

Sum Function in Macro
 
I need to sum variable length rows in a macro. I use; Cells(ActiveCell.Row
+ 1, ActiveCell.Column).Select and then; ActiveCell.FormulaR1C1 =
"=SUM(R[-54]C:R[-1]C)".

Thanks,
Tim



Bob Phillips[_5_]

Sum Function in Macro
 
Tim,

Not really sure what the question is but this will sum from row 1 to the
current row

With ActiveCell
Cells(.Row + 1, .Column).FormulaR1C1 = "=SUM(R1C:R[-1]C)"
End With


What exactly do you want to sum?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tim" wrote in message
t...
I need to sum variable length rows in a macro. I use;

Cells(ActiveCell.Row
+ 1, ActiveCell.Column).Select and then; ActiveCell.FormulaR1C1 =
"=SUM(R[-54]C:R[-1]C)".

Thanks,
Tim






All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com