- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
¦^´_ 1# ÅÚ½³ªd
½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test()
Dim Arr, Brr, xD, xD1, TT, n%, C%, m%, i&, k%
Set xD = CreateObject("Scripting.Dictionary")
Set xD1 = CreateObject("Scripting.Dictionary")
Arr = Range([¸ê®Æ!c1], [¸ê®Æ!a65536].End(3))
For i = 2 To UBound(Arr)
If Arr(i, 2) = "" Then GoTo 99
If Not xD.Exists(Arr(i, 2) & "") Then
k = k + 1: xD(Arr(i, 2) & "") = k
End If
99: Next
ReDim Brr(1 To UBound(Arr), 1 To xD.Count + 1)
With Sheets("§e²{ªí")
.Range("b1").Resize(, xD.Count) = xD.keys
For i = 2 To UBound(Arr)
C = xD(Arr(i, 2) & "") + 1
If xD1.Exists(Arr(i, 1)) Then
m = xD1(Arr(i, 1))
If IsEmpty(Brr(m, C)) Then Brr(m, C) = Arr(i, 3) Else Brr(m, C) = Brr(m, C) & "," & Arr(i, 3)
Else
n = n + 1: xD1(Arr(i, 1)) = n
Brr(n, 1) = Arr(i, 1): Brr(n, C) = Arr(i, 3)
End If
Next
.Range("a2").Resize(n, xD.Count) = Brr
End With
End Sub |
-
-
11.PNG
(105.81 KB)
|