I am looking to subtotal multiple columns some with Sum, others with Average. I am using the following code, but, it is not working, it replaces the sums with the Averages, and I cannot get everything to display properly.
Sub Subtotal()
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), Replace:=False, PageBreaks:=False, _
SummaryBelowData:=True
Selection.Subtotal GroupBy:=1, Function:=xlAverage, TotalList:=Array(19, 20), Replace:=False, PageBreaks:=False, _
SummaryBelowData:=True
End Sub
Can anyone assist me with this problem?
Sub Subtotal()
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), Replace:=False, PageBreaks:=False, _
SummaryBelowData:=True
Selection.Subtotal GroupBy:=1, Function:=xlAverage, TotalList:=Array(19, 20), Replace:=False, PageBreaks:=False, _
SummaryBelowData:=True
End Sub
Can anyone assist me with this problem?