|
Sub Test()
Dim a, ws As Worksheet, dic As Object, s As String, j As String, i As Long, r As Long
Set ws = ThisWorkbook.Sheets("Sheet2")
Set dic = CreateObject("scripting.dictionary")
a = ws.Range("A2:F" & ws.Cells(Rows.Count, 1).End(xlUp).Row).Value
For i = LBound(a, 1) To UBound(a, 1)
s = a(i, 1) & vbTab & a(i, 2)
If Not dic.Exists(s) Then dic(s) = Array(, , 0)
dic(s) = Array(a(i, 1), a(i, 2), dic(s)(2) + a(i, 5))
Next i
ws.Range("G2").Resize(dic.Count, 3).Value = Application.Transpose(Application.Transpose(dic.items))
End Sub
|
|