Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subtotals - show all columns? | Excel Discussion (Misc queries) | |||
Subtotals by Rows and Columns | Excel Programming | |||
Subtotals from multiple columns? | Excel Discussion (Misc queries) | |||
Subtotals multiple columns | Excel Worksheet Functions | |||
Subtotals multiple columns | Excel Worksheet Functions |