macro excel subtotal in subtotal

G

GBO

For a sub total in another subtotal I'm look ing for the second
selection. at the moment I'm using this code but this takes very long
(it repeats 80 times for 140.000 rows in total)

Does anyone have a sugestion tot select the data my second subtotal

' first selection

Range("A1").Select

Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Selection.Subtotal GroupBy:=19, Function:=xlSum,
TotalList:=Array(13, 17) _
, Replace:=True, PageBreaks:=False, SummaryBelowData:=True

' second selection

Cells.Select

Selection.Subtotal GroupBy:=6, Function:=xlSum,
TotalList:=Array(13, 17), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
 
D

Dave Peterson

You may find creating a pivottable is quicker.


For a sub total in another subtotal I'm look ing for the second
selection. at the moment I'm using this code but this takes very long
(it repeats 80 times for 140.000 rows in total)

Does anyone have a sugestion tot select the data my second subtotal

' first selection

Range("A1").Select

Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Selection.Subtotal GroupBy:=19, Function:=xlSum,
TotalList:=Array(13, 17) _
, Replace:=True, PageBreaks:=False, SummaryBelowData:=True

' second selection

Cells.Select

Selection.Subtotal GroupBy:=6, Function:=xlSum,
TotalList:=Array(13, 17), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top