- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, Crr, V, Z, i&, R&, C%, Y&, X%, T$, T1$, T2$
Set Z = CreateObject("Scripting.Dictionary")
Brr = Range([Sheet1!B1], [Sheet1!A65536].End(3))
ReDim Crr(1 To UBound(Brr), 1 To 200)
For i = 2 To UBound(Brr)
If i = 2 Then: Crr(1, 1) = Brr(1, 1) & " \ " & Brr(1, 2): Y = 1
T1 = Brr(i, 1): T2 = Brr(i, 2): T = T1 & "|" & T2
If Z(T) = 1 Then GoTo i01
R = Z(T1): C = Z(T1 & "/c"): C = C + 1: Z(T1 & "/c") = C
If R = 0 Then Y = Y + 1: Crr(Y, 1) = T1: Z(T1) = Y: R = Y
Crr(R, C + 1) = T2: Z(T) = 1
If X < C Then X = C: Crr(1, C + 1) = C
i01: Next
Sheets("Sheet2").UsedRange.Clear
Sheets("Sheet2").[A1].Resize(Y, X + 1) = Crr
Set Z = Nothing: Erase Brr, Crr
End Sub |
|