- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¦^´_ 9# ã´£³¡ªL
«e½ú¤È¦w
¥H¤U¬O¥Î¤TÓ¦r¨å¤è¦¡³B¸Ì,½Ð«e½ú¦A«ü¾É!
ÁÂÁ«e½ú
Option Explicit
Sub TEST_20221028()
Dim Arr, i&, j&, T1, T2, T3, W, X, Y, Z, C, R
Arr = Range([¸ê®Æ!c1], [¸ê®Æ!a1].Cells(Rows.Count, 1).End(xlUp))
Set X = CreateObject("Scripting.Dictionary")
Set Y = CreateObject("Scripting.Dictionary")
Set W = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(Arr)
T1 = Arr(i, 1)
T2 = Arr(i, 2)
T3 = Format(Arr(i, 3), "0000")
Y(T1) = ""
X(T2 & "|" & T3) = ""
W(T1 & "|" & T2 & "|" & T3) = T3
Next
ReDim Arr(1 To Y.Count + 1, 1 To X.Count + 1)
i = 1
For Each R In Y.KEYS
i = i + 1
Arr(i, 1) = R
j = 1
For Each C In X.KEYS
j = j + 1
Arr(i, j) = W(R & "|" & C)
Arr(1, j) = IIf(i = 2, C, Arr(1, j))
Next
Next
Arr(1, 1) = "¡@¡@¡@ì®Æ¡@½s¸¹"
With [§e²{ªí!A1].Resize(UBound(Arr), UBound(Arr, 2))
.Value = Arr
.Columns(2).Resize(, UBound(Arr, 2)).Sort Key1:=.Cells(1, 2), Order1:=xlAscending, Header:=xlNo, Orientation:=xlLeftToRight
.Rows(2).Resize(UBound(Arr)).Sort Key1:=.Cells(2, 1), Order1:=xlAscending, Header:=xlNo, Orientation:=xlTopToBottom
.Rows(1).Replace "|*", "", Lookat:=xlPart
.Borders.LineStyle = 1
End With
End Sub |
|