- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-12-20 22:01 ½s¿è
¦^´_ 1# Genie - Sub test()
- Dim ar, d, arEQ, i As Long
-
- '½Æ»s¨Ó·½
- With Sheets("Sheet1")
- .AutoFilterMode = False
- .[A1].CurrentRegion.Copy Sheets("Sheet2").[A1]
- .[A1].AutoFilter
- End With
-
- With Sheets("Sheet2")
- '±Æ§Ç
- With .Sort
- .SortFields.Clear
- .SortFields.Add .Parent.Range("B2:B" & Rows.Count), xlSortOnValues, xlAscending
- .SortFields.Add .Parent.Range("C2:C" & Rows.Count), xlSortOnValues, xlAscending
- .SetRange .Parent.[A1].CurrentRegion
- .Header = xlYes
- .Orientation = xlTopToBottom
- .SortMethod = xlPinYin
- .Apply
- End With
-
- '§ä¥X¨C¬q°_©l¦ì¸m
- ar = .[A1].CurrentRegion.Value
- Set d = CreateObject("scripting.dictionary")
- For i = 2 To UBound(ar)
- If ar(i, 2) <> ar(i - 1, 2) Then d(ar(i, 2)) = i
- Next i
-
- '¥Ñ«á©¹«e¤À³Î¡A´¡¤JªÅ¥Õ
- arEQ = d.keys
- For i = UBound(arEQ) To LBound(arEQ) + 1 Step -1
- .Range(.Cells(d(arEQ(i)), "D"), .Cells(.Rows.Count, "D")).Insert xlToRight
- .Rows(d(arEQ(i))).Insert xlDown
- Next i
- .[D1].Resize(, d.Count).Value = d.keys
- End With
- End Sub
½Æ»s¥N½X |
|