Try this
Sub abc()
Dim i As Long, ii As Long
Dim a
a = Range("a2:bc" & Cells(Rows.CountLarge, "a").End(xlUp).Row)
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 1 To UBound(a, 1)
For ii = 2 To UBound(a, 2)
If Not .Exists(a(i, 1)) Then
.Item(a(i, 1)) = a(i, 1)
Else
If Not IsEmpty(a(i, ii)) Then
.Item(a(i, 1)) = .Item(a(i, 1)) & "," & a(i, ii)
End If
End If
Next
Next
a = .Items
Worksheets.Add after:=Worksheets(Worksheets.Count)
For i = LBound(a) To UBound(a)
s = Split(a(i), ",")
Cells(i + 1, 1).Resize(, UBound(s) + 1) = s
Next
Range("a1").Resize(i, UBound(a)).Borders.LineStyle = xlContinuous
End With
End Sub
Bookmarks