Change the name of sheet 8 and should have a name sheet called Output sheet
Sub jimmy()
Dim x, i As Long, P As Long, k As Long, n As Long
With Sheets("Sheet8").Range("a1").CurrentRegion
x = .Value
With CreateObject("Scripting.Dictionary")
.comparemode = 1
For i = 1 To UBound(x)
If .exists(x(i, 1)) Then
n = .Item(x(i, 1))
x(.Item(x(i, 1)), 2) = x(.Item(x(i, 1)), 2) + x(i, 2)
Else
P = P + 1
.Item(x(i, 1)) = P
For k = 1 To UBound(x, 2)
x(P, k) = x(i, k)
Next k
End If
Next i
End With
With Sheets("Output")
.Cells.ClearContents
.Range("A1").Resize(P, UBound(x, 2)).Value = x
.Range("A1").CurrentRegion.Sort key1:=Range("A2"), order1:=xlAscending, _
Header:=xlNo, DataOption1:=xlSortTextAsNumbers
.Activate
End With
End With
Bookmarks