Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I'm trying to automate a Subtotal function, ie, I want to SUM the data
in columns C onwards for each change in column A: Code: Private Sub SubTotalSummaryData(LasDateCol As Byte) Dim DataArray() As Byte, cnt As Byte, i As Byte With Worksheets("Summary") ' Populate array of all used columns of data- used by the Subtotal function. ReDim DataArray(LasDateCol - 2) cnt = 0 For i = 3 To LasDateCol DataArray(cnt) = i cnt = cnt + 1 Next i .UsedRange.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(DataArray()), Replace:=True, PageBreaks:=False, SummaryBelowData _ :=True End With End Sub The number of columns present will vary each time the procedure is called thus I tried creating an array of all the used columns via the FOR....NEXT loop, but VBA doesn't like it. Any ideas? -- | +-- Julian | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel gets subtotals out of order using multiple sorts and subtot. | Excel Discussion (Misc queries) | |||
Subtotals | Excel Discussion (Misc queries) | |||
Subtotals Problem when Filtering | Excel Discussion (Misc queries) | |||
In Excel, how do you copy and paste just the subtotals into anoth. | Excel Discussion (Misc queries) | |||
why are nested subtotals coming out below outer subtotals? | Excel Worksheet Functions |