|
Option Explicit
Sub TEST9()
Dim ar, br, i&, r&, dic As Object, vKey
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
ar = [C1].CurrentRegion.Value
For i = 2 To UBound(ar)
If Not dic.exists(ar(i, 1)) Then
Set dic(ar(i, 1)) = CreateObject("Scripting.Dictionary")
End If
dic(ar(i, 1))(ar(i, 2)) = Empty
Next i
ReDim br(1 To dic.Count, 1 To 2)
For Each vKey In dic.keys
r = r + 1
br(r, 1) = vKey
br(r, 2) = Join(dic(vKey).keys, "、")
Next
[I2].Resize(UBound(br), 2) = br
Set dic = Nothing
Application.ScreenUpdating = True
End Sub |
|