Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to use the Excel Subtotals function for a scenario where the number of columns needing to be subtotaled varies -- there may be 4 columns in one run of the code, but there may be 20 columns in the next run. Below is the recorded code I have tinkered with -- but I am stuck on how to code it in a loop so that the number of columns can be set differently each time the code is run. Any suggestions are appreciated! 'The headers are in row 2 and the actual data to be subtotaled begins in row 3 With Sheets("Commission by Entity breakdown") .Range("A2").subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(4, 6, 7, 9, _ 11, 13, 15, 17, 19, 20, 22, 24, 26, 28, 29, 31, 33, 34, 35, 37), Replace:=True, PageBreaks:= _ False, SummaryBelowData:=False End With -- Robert |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) | Excel Discussion (Misc queries) | |||
vba code for subtotals and percentages | Excel Programming | |||
vba code for subtotals and percentages | Excel Programming | |||
vba code for subtotals and percentages | Excel Programming | |||
**HELP** VBA code to insert subtotals | Excel Programming |