Sub test()
Dim d, arr, s$, i&
Set d = CreateObject("scripting.dictionary")
arr = Sheet1.UsedRange
For i = 3 To UBound(arr)
If Not d.exists(arr(i, 5)) Then
d(arr(i, 5)) = Array(arr(i, 1), arr(i, 5), Format(arr(i, 2), "m/d"))
Else
s = d(arr(i, 5))(2) & " " & Format(arr(i, 2), "m/d") & " "
d(arr(i, 5)) = Array(d(arr(i, 5))(0), d(arr(i, 5))(1), s)
End If
Next
With Sheet2
.UsedRange.Offset(2).ClearContents
.Range("a3").Resize(d.Count, 3) = Application.Transpose( _
Application.Transpose(d.items))
End With
Set d = Nothing
End Sub
|