- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 11# gctsai
¨Ï¥Î¤u§@ªíªº¹w³]¨Æ¥óWorksheet_Change,³o¬O§Aªþ¥óSheets("¨Ó·½")ªºµ{¦¡½X.- Private Sub Worksheet_Change(ByVal Target As Range)
- Ex
- End Sub
- Private Sub Ex()
- Dim D As Object, Rng As Range
- Set D = CreateObject("SCRIPTING.DICTIONARY") '³]¥ß¦r¨åª«¥ó
- Set Rng = Sheets("¨Ó·½").[A2] '³]¥ßÀx¦s®æª«¥ó
- With Sheets("²Îp")
- Do While Rng <> "" 'RngªºÈ¬°ªÅ¥Õ®É¤£°õ¦æ Doªº°j°é
- If Rng = .[A2] Then D(Rng.Offset(, 1).Value) = D(Rng.Offset(, 1).Value) + 1
- ' .[A2] ->Sheets("²Îp")[A2] '¦r¨åª«¥ó(KEY)=ITEM + 1
- Set Rng = Rng.Offset(1) 'Rng¤U²¾¤@¦C¦ì
- Loop
- With .[B2:C2]
- .Cells(1).Resize(D.Count) = Application.Transpose(D.KEYS)
- .Cells(2).Resize(D.Count) = Application.Transpose(D.ITEMS)
- .Resize(D.Count, 2).Sort Key1:=.Cells(1), Order1:=xlAscending, Header:=xlNo
- End With
- End With
- Set D = Nothing
- Set Rng = Nothing
- End Sub
½Æ»s¥N½X |
|