M
michael.beckinsale
Hi All,
I think this should be pretty straightforward but the answer is
eluding me. Its a Friday and l am tired!
I want to apply subtotals to a range using VBA the rub being that the
1st column for the subtotals is variable (say column 8 (H) in this
example) and the last column will always be +90 (98 in this example)
My idea was to find the 1st & last column number, create an array and
assign to an array variable to use in the subtotal function.
Please help, l am failing miserably!
Sample code ----- DOES NOT WORK
Sub SP_SubTotals()
Dim STArray(8 To 98) >>> this to be replaced by LC(last column)
Sheets("Staff Planner").Activate
Range(Cells(4, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=(STArray),
_
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End Sub
TIA
Michael Beckinsale
I think this should be pretty straightforward but the answer is
eluding me. Its a Friday and l am tired!
I want to apply subtotals to a range using VBA the rub being that the
1st column for the subtotals is variable (say column 8 (H) in this
example) and the last column will always be +90 (98 in this example)
My idea was to find the 1st & last column number, create an array and
assign to an array variable to use in the subtotal function.
Please help, l am failing miserably!
Sample code ----- DOES NOT WORK
Sub SP_SubTotals()
Dim STArray(8 To 98) >>> this to be replaced by LC(last column)
Sheets("Staff Planner").Activate
Range(Cells(4, 1), Cells(LR, LC)).Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=(STArray),
_
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End Sub
TIA
Michael Beckinsale