ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum Formula (https://www.excelbanter.com/excel-programming/329762-sum-formula.html)

Josh O.

Sum Formula
 
How can I enter a formula with a macro that will sum all the rows above it in
that column? I need the formula to be entered into the cell 2 rows below the
last row with data in that column.

Harald Staff

Sum Formula
 
Sub SumFormula()
Cells(65000, ActiveCell.Column).End(xlUp). _
Offset(2, 0).FormulaR1C1 = "=SUM(R1C:R[-2]C)"
End Sub

HTH. Best wishes Harald

"Josh O." skrev i melding
...
How can I enter a formula with a macro that will sum all the rows above it

in
that column? I need the formula to be entered into the cell 2 rows below

the
last row with data in that column.





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

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