This should do it
Sub abc()
Dim i As Long, ii As Long, a
With Worksheets("sheet1")
a = .Range("a1").CurrentRegion
End With
With CreateObject("scripting.dictionary")
.comparemode = 1
For i = 1 To UBound(a)
If Not IsEmpty(a(i, 1)) Then
ii = i
.Item(a(i, 1)) = a(i, 3)
Else
.Item(a(ii, 1)) = .Item(a(ii, 1)) & ", " & a(i, 3)
End If
Next
With Worksheets("sheet2")
a = .Range("a2", .Cells(Rows.Count, 1).End(xlUp).Offset(, 1))
End With
For i = 1 To UBound(a)
If .exists(a(i, 1)) Then a(i, 2) = .Item(a(i, 1))
Next
With Worksheets("sheet2")
.Range("a2").Resize(UBound(a), UBound(a, 2)) = a
End With
End With
End Sub
Bookmarks