- ©«¤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
        
|
¦^´_ 3# b9208
¤£©ú¥Õªº¨ç¼Æ,¤èªk,ÄÝ©Ê,¥i¦bµ{¦¡½X¤¤¥Î·Æ¹«¿ï¨ú«á,«öF1¬d¬Ý»¡©ú
¦^´_ 4# b9208
µ{¦¡½X¶·×§ï¦p¤U- Option Explicit
- Sub Ex()
- Dim DataBase As Range, I As Integer, D As Object, D_Item As Variant
- Dim W As String
- Set D = CreateObject("SCRIPTING.DICTIONARY") '¦r¨åª«¥ó
- With Sheets("¤u§@ªí1")
- Set DataBase = .Range("A5").Resize(.[B5].End(xlDown).Row - 4, 9) '¨î©w½d³ò
- End With
- With DataBase
- .Sort Key1:=.Cells(1, 2), Order1:=xlAscending, Key2:=.Cells(1, 3), Order2:=xlAscending, Key3:=.Cells(1, 4), Order3:=xlAscending, Header:=xlYes
- '2003 ±Æ§Ç¥u¦³3ӱƧÇÄæ¦ì :¬P´Á,®Æ¸¹,³æ¦ì
- .Sort Key1:=.Cells(1, 2), Order1:=xlAscending, Key2:=.Cells(1, 3), Order2:=xlAscending, Key3:=.Cells(1, 6), Order3:=xlAscending, Header:=xlYes
- '¦A¦¸±Æ§Ç:¬P´Á,®Æ¸¹,©m¦W
- For I = 1 To .Rows.Count
- With .Rows(I)
- W = .Cells(2) & .Cells(3) & .Cells(4) & .Cells(6) '¡u¬P´Á+®Æ¸¹+³æ¦ì+©m¦W¡v¥|Äæ¦ì¸ê®Æ
- End With
- If Not D.Exists(W) Then
- 'Exists ¤èªk ¦pªG¦b Dictionary ª«¥ó¤¤«ü©wªºÃöÁä¦r¦s¦b¡A¶Ç¦^ True¡AY¤£¦s¦b¡A¶Ç¦^ False¡C
- '»yªk Object.Exists (key)
- Set D(W) = .Rows(I) ''¦r¨åª«¥óªº¤º®e: ¬°Range
- Else
- Set D(W) = Union(D(W), .Rows(I)) 'Union ¤èªk ¶Ç¦^¨âөΦhÓ½d³òªº¦X¨Ö½d³ò¡C
- End If
- Next
- For Each D_Item In D.ITEMS '¨Ì§Ç¶Ç¦^ ¦r¨åª«¥óªº¤º®e
- With D_Item '¦r¨åª«¥óªº¤º®e: ¬°Range
- If .Rows.Count > 1 Then '
- For I = 2 To .Rows.Count '±q²Ä2¦C¶}©l
- .Rows(I).Interior.Color = vbYellow
- .Rows(I).Cells(4) = 0
- .Rows(I).Cells(4).Font.Color = vbRed
- Next
- End If
- End With
- Next
- End With
- End Sub
½Æ»s¥N½X |
|