- ©«¤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-11-28
|
¦^´_ 4# ã´£³¡ªL
ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
¥H¤U¾Ç²ß¤ß±oµù¸Ñ,½Ð«e½ú¦A«ü¾É
Sub TEST_1()
Dim xR As Range, T$(2), S$(2), N%
'¡ô«Å§iÅܼÆ:xRÅܼƬO Àx¦s®æÅܼÆ,(T,S)ÅܼƬO0~2¯Á¤Þ¸¹ªº¦r¦ê¤@ºû°}¦C,N¬Oµu¾ã¼Æ
For Each xR In Range([a2], [a65536].End(3))
'¡ô³]°j°é!¥OxR¬O [A2]¨ìAÄæ³Ì«á¦³¤º®eÀx¦s®æ½d³ò¤§¤@Àx¦s®æ
T(1) = xR: T(2) = xR(1, 2)
'¡ô¥OT°}¦C1¯Á¤Þ¸¹°}¦CȬOxR
'¡ô¥OT°}¦C2¯Á¤Þ¸¹°}¦CȬOxR¥k1®æÀx¦s®æÈ
If T(1) <> S(1) Then S(1) = T(1): S(2) = "\\": N = 0
'¡ô¦pªGT°}¦C1¯Á¤Þ¸¹°}¦CÈ»P S°}¦C1¯Á¤Þ¸¹°}¦CȤ£¦P?
'¡ôTrue´N¥OS°}¦C2¯Á¤Þ¸¹°}¦CȬO "\\"
'¡ô¥ONÅܼÆÂk¹s
N = N - (T(2) <> S(2))
'¡ô¥ONÅܼƩó((T°}¦C2¯Á¤Þ¸¹°}¦CÈ<> T°}¦C2¯Á¤Þ¸¹°}¦CÈ)ÅÞ¿èÈTrue)®É,
'²Ö¥[1 µù: -(TRUE) = -(-1) = +1
S(2) = T(2)
'¡ô¥OS°}¦C2¯Á¤Þ¸¹°}¦CȬO T°}¦C2¯Á¤Þ¸¹°}¦CÈ
xR(1, 3) = N
'¡ô¥OxR¥k2®æÀx¦s®æȬO NÅܼÆ
Next
End Sub
Sub TEST_2()
Dim xR As Range, T$, TT$, S$, SS$, N%
'¡ô«Å§iÅܼÆ:xRÅܼƬO Àx¦s®æÅܼÆ,(T,TT,S,SS)ÅܼƬO¦r¦êÅܼÆ,N¬Oµu¾ã¼Æ
For Each xR In Range([a2], [a65536].End(3))
'¡ô³]°j°é!¥OxR¬O AÄæÀx¦s®æ¤§¤@
T = xR: TT = T & "\" & xR(1, 2)
'¡ô¥OT³o¦r¦êÅܼƬO xRÅܼÆÈ
'¡ô¥OTT³o¦r¦êÅܼƬO TÅܼƳs±µ"\",¦A³s±µxR¥k1®æÀx¦s®æȲզ¨ªº·s¦r¦ê
N = N * -(T = S) - (TT <> SS)
'¡ô¥ON³oµu¾ã¼ÆÅܼƬO ¦Û¨¼ÅÞ¿èÈ«á,¦A§PÂ_ÅÞ¿èÈTrue®É,²Ö¥[1
'1.·í T(¾÷¥x)<>S(«e¾÷¥x) ®É N * -(T = S)·|N*-(0) = N*0 = 0,
'§_«h N*-(-1) = N*1 = N
'2.·í ¾÷¥x\§Ç¸¹<>«e¾÷¥x\«e§Ç¸¹ ®É,-(TT <> SS) = -(-1) = 1
'§_«h -(TT <> SS) = -(0) = 0
'3.°j°é¤@¶}©lªºSÅܼƻPSSÅܼƳ£¬O"",©Ò¥H(T=S) = FALSE = 0,
'-(TT <> SS) = -(TRUE) = 1
S = T: SS = TT
'¡ô¥OSÅܼÆȬO TÅܼÆÈ(³o¬On°O¦í·í¤U¾÷¥xµ¹¤U¤@°j°é¤ñ¸û)
'¡ô¥OSSÅܼÆȬO TTÅܼÆÈ(³o¬On°O¦í²Õ¦X¦r¦êµ¹¤U¤@°j°é¤ñ¸û)
xR(1, 3) = N
'¡ô¥OxR¥k2®æÀx¦s®æȬO NÅܼÆ
Next
End Sub |
|