that code doesn't make sense to me
Sub test()
Dim a, e, w, i As Long, ii As Long, n As Long
a = [a1].CurrentRegion.Value
With CreateObject("Scripting.Dictionary")
For i = 2 To UBound(a, 1)
If Not .exists(a(i, 4)) Then
ReDim w(1 To UBound(a, 2), 1 To 2)
w(1, 1) = a(i, 4)
Else
w = .Item(a(i, 4))
ReDim Preserve w(1 To UBound(w, 1), 1 To UBound(w, 2) + 1)
End If
For ii = 1 To UBound(a, 2)
w(ii, UBound(w, 2)) = a(i, ii)
Next
.Item(a(i, 4)) = w
Next
n = 1
For Each e In .keys
Cells(n, "h").Resize(UBound(.Item(e), 2), UBound(a, 2)) = Application.Transpose(.Item(e))
n = n + UBound(.Item(e), 2) + 2
Next
End With
End Sub
Bookmarks