MWE,
It looks like you want a macro that will always perform the subtotal on the selection, using the first selected column as the "group by", and each additional column as the TotalList?
If you wanted 2, 3, 4, 5 to be the TotalList, and "arr" was your variant array, you would need to assign it like:
arr(0) = 2
arr(1) = 3
arr(2) = 4
arr(3) = 5
But of course, that is knowing what fields you need. You can do it programatically like:
Sub subt()
Dim TotalListArr(), i As Long, j As Long
ReDim TotalListArr(Selection.Columns.Count - 2)
For i = 2 To Selection.Columns.Count
TotalListArr(j) = i
j = j + 1
Next i
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=TotalListArr, _
Replace:=True, PageBreaks:=False, SummaryBelowData:=xlSummaryBelow
End Sub
Any questions, let me know!
Matt