Try
Sub test()
Dim a, i As Long, ii As Long, txt As String
With Sheets("data").Cells(1).CurrentRegion
a = .Resize(, Application.Max(.Columns.Count, 9)).Value
End With
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a, 1)
txt = Join(Array(a(i, 2), a(i, 5)), Chr(2))
If Not .exists(txt) Then
.Item(txt) = .Count + 1
For ii = 1 To UBound(a, 2)
a(.Count, ii) = a(i, ii)
Next
Else
a(.Item(txt), 9) = a(.Item(txt), 9) + a(i, 9)
End If
Next
i = .Count
End With
With Sheets.Add.Cells(1).Resize(i, UBound(a, 2))
.Value = a: .Columns.AutoFit
End With
End Sub
Bookmarks