|
Sub test()
Dim A, d, i, x
Sheets(1).Select
A = Range("a1").CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(A)
If d.exists(A(i, 1)) = False Then Set d(A(i, 1)) = CreateObject("scripting.dictionary")
d(A(i, 1))(A(i, 2)) = A(i, 3)
Next i
Sheets(3).Select
Cells = ""
i = 1
For Each x In d.keys
Cells(1, i) = x
Cells(1, i + 1) = "图号"
Cells(2, i).Resize(d(x).Count) = Application.Transpose(d(x).keys)
Cells(2, i + 1).Resize(d(x).Count) = Application.Transpose(d(x).items)
i = i + 2
Next
End Sub
|
|