This should do
Sub test()
Dim a, i As Long, ii As Long, n As Long
With Range("a5").CurrentRegion
With .Offset(2, 1).Resize(.Rows.Count - 2, .Columns.Count - 1)
a = .Value
.ClearContents
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 1 To UBound(a, 1)
If a(i, 1) = "" Then Exit For
If Not .exists(a(i, 1)) Then
n = n + 1: .Item(a(i, 1)) = n
For ii = 1 To UBound(a, 2)
a(n, ii) = a(i, ii)
Next
Else
For ii = 2 To UBound(a, 2)
a(.Item(a(i, 1)), ii) = _
a(.Item(a(i, 1)), ii) + a(i, ii)
Next
End If
Next
End With
.Resize(n).Value = a
End With
End With
End Sub
Bookmarks