Too may characters in one cell to dump the results in one go
Sub testToOtherSheet()
Dim a, i As Long, n As Long
With Sheets("1")
a = .Range("a1", .Range("a" & Rows.Count).End(xlUp)).Resize(, 2).Value
End With
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 1 To UBound(a, 1)
If a(i, 1) <> "" Then
If Not .exists(a(i, 1)) Then
.Item(a(i, 1)) = .Count + 1
a(.Item(a(i, 1)), 1) = a(i, 1)
a(.Item(a(i, 1)), 2) = a(i, 2)
Else
a(.Item(a(i, 1)), 2) = _
Join(Array(a(.Item(a(i, 1)), 2), a(i, 2)), "-")
End If
End If
Next
n = .Count
End With
With Sheets("2").Cells(1)
.CurrentRegion.ClearContents
For i = 1 To n
.Cells(i, 1).Value = a(i, 1)
.Cells(i, 2).Value = a(i, 2)
Next
End With
End Sub
Bookmarks