You changed from A:G and sorting on column C to A:E and doing a subtotal based
on A?
After you've used the other stuff to sort by column A (I would guess???), then
you could use something like this to subtotal:
Option Explicit
Sub testme()
Dim LastRow As Long
Dim FirstRow As Long
Dim LastRowInCol As Long
Dim iCol As Long
Dim myRng As Range
With Worksheets("sheet1")
FirstRow = 6 'includes last header row
LastRow = 7 'just start with something a little bigger
For iCol = 1 To 5 'A:E
LastRowInCol = .Cells(.Rows.Count, iCol).End(xlUp).Row
If LastRowInCol > LastRow Then
LastRow = LastRowInCol
End If
Next iCol
Set myRng = .Range(.Cells(FirstRow, "A"), .Cells(LastRow, "E"))
'stop any "can't determine header warning"
Application.DisplayAlerts = False
myRng.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(2, 5), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Application.DisplayAlerts = True
End With
End Sub
The .subtotal stuff came from recording a macro when I did it manually.