ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cumulative Column when using Sub Totals Q (https://www.excelbanter.com/excel-programming/452709-cumulative-column-when-using-sub-totals-q.html)

[email protected]

Cumulative Column when using Sub Totals Q
 
I have the Code below that places a Formula in Cells L13 & L14, then copies the formula in L14 down to last active Row. Essentially this produces a Running Total

How can I adjust this, if I have Sub Total's inserted, instead of a Running total just for the Sub Total Rows, its a Running Total of all Rows?

Sub CopyFormula()
Dim LastRow As Long

Sheets("Report").Select
Range("L13").Select
ActiveCell.FormulaR1C1 = "=RC[-1]"
Range("L14").Select
ActiveCell.FormulaR1C1 = "=RC[-1]+R[-1]C"

LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("L14:L" & LastRow).FillDown
Range("A1").Select


End Sub


All times are GMT +1. The time now is 03:43 AM.

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