Hi I need help with the subtotal code:
Please see attached image to understand how my table will look like for a full year.
I need to produce YTD tables where not all months will be included.
For Jan YTD, my code will look like this:
Range("A3").Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=Array(3, 4), Replace:=True, _
PageBreaks:=False, SummaryBelowData:=True
For Jun YTD, my code will look like this:
Range("A3").Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=Array(3, 4, 5, 6, 7, 8, 9), Replace:=True, _
PageBreaks:=False, SummaryBelowData:=True
and for Dec YTD, my code will look like this:
Range("A3").Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=Array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
How can i automate this instead of changing the array every month?
Any help is greatly appreciated!
Bookmarks