Subtotals
Having trouble running two levels of subtotals in sequence - It's not giving me a error on run time, but rather not grouping the subtotals correctly?? Anyhelp would be appreciated.
'----------------------------
Private Sub CmdDiv_Click()
DistributionDiv
DistributionRgn
End Sub
'----------------------------
Sub DistributionDiv()
Worksheets("Final").Range("E11").Select
Selection.Subtotal GroupBy:=5, Function:=xlSum, TotalList:=Array(6, 7, 9, 10, _
12, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, _
42, 43, 45, 46, 48, 49, 51, 52, 54, 55, 57, 58, 60, 61, 63, 64, 66, 67, 69, 70, _
72, 73, 75, 76, 78, 79, 81, 82, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, _
98, 99, 100, 101, 102, 103, 104, 105, 106, 107), Replace:= _
False, PageBreaks:=False, SummaryBelowData:=True
End Sub
'--------------------------
Sub DistributionRgn()
Worksheets("Final").Range("E11").Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(6, 7, 9, 10, _
12, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, _
42, 43, 45, 46, 48, 49, 51, 52, 54, 55, 57, 58, 60, 61, 63, 64, 66, 67, 69, 70, _
72, 73, 75, 76, 78, 79, 81, 82, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, _
98, 99, 100, 101, 102, 103, 104, 105, 106, 107), Replace:= _
False, PageBreaks:=False, SummaryBelowData:=True
End Sub
|