- ©«¤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
|
¦^´_ 3# ã´£³¡ªL
ÁÂÁ«e½ú
«á¾ÇÂǦ¹©«¾Ç²ß«e½úªº¤è®×,¤è®×¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦b«ü¾É
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub test_01()
Dim Arr, xD, i&, T$, U&, TM
'¡ô«Å§iÅܼÆ
TM = Timer
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxDÅܼƬO ¦r¨å
Arr = Range([C2], Cells(Rows.Count, 3).End(3))
'¡ô¥OArrÅܼƬO ¤Gºû°}¦C,¥HÀx¦s®æȱa¤J°}¦C¤¤
For i = 1 To UBound(Arr)
'¡ô³]¶¶°j°é
T = Arr(i, 1): U = xD(T): Arr(i, 1) = ""
'¡ô¥OTÅܼƬO Arr°}¦CÈ(ÃöÁä¦r),
'¥OUÅܼƬO ÃöÁä¦r¬dxD¦r¨åªºitemÈ
'¥O²M°£±¼Arr°}¦C¸ÌªºÈ
If U > 0 Then Arr(U, 1) = "«ÂÐ": xD(T) = -1: U = -1
'¡ô¦pªGUÅܼƤj©ó0,¥Nªí¦¹ÃöÁä¦r¦bArr°}¦Ci¦CÈÁÙ¤£¬O "«ÂÐ",
'¤]´N¬Oªì¦¸Àˬd¨ì«ÂÐ!´N¥OArr°}¦CUÅܼƦCȬO "«ÂÐ"¦r¦ê,
'¥O¦¹ÃöÁä¦rªºitem§ï¬°-1,¥OUÅܼƬO -1
If U < 0 Then Arr(i, 1) = "«ÂÐ"
'¡ô¦pªGUÅܼƤp©ó0,¥NªíArr°}¦C³o°j°é¦CȬO«½Æªº,
'´N¥OArr°}¦Ci°j°é¦CȬO "«ÂÐ"¦r¦ê
If U = 0 Then xD(T) = i
'¡ô¦pªGUÅܼƬO 0,¥Nªí¦¹ÃöÁä¦r¬O²Ä1¦¸¥X²{,
'¥u¥H¦¹ÃöÁä¦r·íkey,item¬Oi°j°é¼Æn¯Ç¤JxD¦r¨å¸Ì´N¦n
Next i
[B2].Resize(UBound(Arr)) = Arr
'¡ô¥OArr°}¦Cȱq[B2]ÂX®iªºÀx¦s®æ¤¤¼g¤J
MsgBox Timer - TM
End Sub |
|