![]() |
Sub Totals - URGENT
I have the following piece of code to create sub-totals
across a range of data. The Excel sub total method actually does 3 sweeps to create totals on fields 1, 4 and then 6. Using the showlevel buttons I then format the subtotals at various levels. This works great except that I now need to introduce another 2 subtotals. When I coded this and tested it, the showlevel buttons only went up to 8 and the expand/contract lines didn't select the data I'd expected it to. Also I got an error message something like subscript out of range. Is there a limit to subtotals and if so what could I use as an alternative other than Pivot Tables? Can anyone help, this is really urgent. Many thanks Jacqui Below is the original code which works absolutely fine based on 3 sweeps. With ActiveSheet .UsedRange.Subtotal groupby:=1, Function:=xlSum, totallist:=colArray, _ Replace:=True .UsedRange.Subtotal groupby:=4, Function:=xlSum, totallist:=colArray, _ Replace:=False .UsedRange.Subtotal groupby:=6, Function:=xlSum, totallist:=colArray, _ Replace:=False End With ActiveSheet.Outline.ShowLevels 6 Application.StatusBar = "Applying formats to Sub Totals" With ActiveWorkbook .Styles("rowlevel_6").Font.Bold = True With .Styles("rowlevel_5").Font .Bold = True .Italic = True End With End With ActiveSheet.Outline.ShowLevels 7 etc, etc |
All times are GMT +1. The time now is 03:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com