ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¿ï¾Ü¤U©Ô¦¡²M³æ¦Û°Ê¶ñ¤J

[µo°Ý] ¿ï¾Ü¤U©Ô¦¡²M³æ¦Û°Ê¶ñ¤J

½Ð±Ð¹F¤H:
1.        ­YE4=B4¡BF4=C4¡AF5­È¦Û°Ê¶ñ¤JF9
2.        ­YE4=B4¡BF4=C5¡AF5­È¦Û°Ê¶ñ¤JF10
3.        ­YE4=B4¡BF4=C6¡AF5­È¦Û°Ê¶ñ¤JF11
4.        ­YE4=B5¡BF4=C4¡AF5­È¦Û°Ê¶ñ¤JF12
5.        ­YE4=B5¡BF4=C5¡AF5­È¦Û°Ê¶ñ¤JF13
6.        ­YE4=B5¡BF4=C6¡AF5­È¦Û°Ê¶ñ¤JF14
½Ð±ÐVBA©Î¨ç¼Æ¦p¦ó¼g?
·s¼W Microsoft Excel ¤u§@ªí.rar (6.08 KB)
¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

¦^´_ 31# ­ã´£³¡ªL


    ÁÂÁ«e½ú
ÁA¸Ñ¤F

Sub TEST()
MsgBox ([A1] = [A1]) + ([B1] = [B1])
End Sub
µ²ªG­È¬O -2

Sub TEST_1()
MsgBox ([A1] <> [A1]) + ([B1] <> [B1])
End Sub
µ²ªG­È¬O 0
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 30# Andy2483


MsgBox (1 = 1) + (2 = 2)

§Ú³o = -2

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-25 15:01 ½s¿è

¦^´_ 29# ­ã´£³¡ªL


    ÁÂÁ«e½ú«ü¾É
³o°ÝÃDÀ³¸Ó¬OVBAªº°ò¦,«á¾Ç¤£¨D¬Æ¸Ñ,¤@ª½¿ù»~»{ª¾¤¤¾Ç²ß,ÁÂÁ«e½úªº´£Äâ

Sub TEST()
MsgBox ([A1] = [A1]) + ([B1] = [B1])
End Sub

°õ¦æµ²ªG:


============================================
Sub TEST_1()
MsgBox ([A1] <> [A1]) + ([B1] <> [B1])
End Sub
µ²ªG­È¬O 0
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 27# Andy2483


VBA¤¤ªº True ¶ñ¬° -1, »P¤½¦¡¤¤ªº 1 ¤£¦P

TOP

¦^´_ 27# Andy2483
·PÁÂAndy2483¤j¥[¤W¤¤¤åµù¸Ñ
¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-24 08:36 ½s¿è

¦^´_ 23# ­ã´£³¡ªL


    ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
«á¾Ç¾Ç²ß¤ß±o¦p¤U,½Ð«e½ú¦A«ü¾É

'§Q¥Î index ­È¶ñ¥R//
https://learn.microsoft.com/zh-t ... sheetfunction.index
Private Sub Worksheet_Change(ByVal Target As Range)
'¡ô·í¨Ï¥ÎªÌ©Î¥~³¡³sµ²Åܧó¤u§@ªí¤¤ªºÀx¦s®æ®É·|µo¥Í¦¹¨Æ¥ó¡C
Dim j%, k%
'¡ô«Å§iÅܼÆ:(j,k)¬Oµu¾ã¼Æ
With Target
'¡ô¥H¤U¬OÃö©óIJµoªºµ{§Ç
     If .Address <> "$E$4" And .Address <> "$F$4" Then Exit Sub
     '¡ô¦pªGIJµo®æªº¦ì§}¤£¬O "$E$4"¦Ó¥B¤]¤£¬O "$F$4" ´Nµ²§ôµ{¦¡°õ¦æ
     j = Abs(([e4] = [b4]) + ([e4] = [b5]) * 4)
     '¡ô¥Oj³oµu¾ã¼Æ¬O µ´¹ï­È(¥¬ªL­È + ¥¬ªL­È *4)
     '¦pªG[e4] = [b4] ¨ä¥¬ªL­È¬O1,¦A¦pªG[e4] = [b5]¥¬ªL­È¬O0*4=0 ,µ²ªG­È¬O1
     '¦pªG[e4] = [b4] ¨ä¥¬ªL­È¬O0,¦A¦pªG[e4] = [b5]¥¬ªL­È¬O1*4=4 ,µ²ªG­È¬O4

     k = Abs(([f4] = [c4]) + ([f4] = [c5]) * 2 + ([f4] = [c6]) * 3)
     '¡ô¥Ok³oµu¾ã¼Æ¬O µ´¹ï­È(¥¬ªL­È + ¥¬ªL­È *2)+(¥¬ªL­È *3)
     '[f4]=[c4]_¨ä¥¬ªL­È¬O1,[f4]=[c5]_¥¬ªL­È¬O0*2=0,[f4]=[c6]¬O0*3=0,µ²ªG­È¬O1
     '[f4]=[c4]_¨ä¥¬ªL­È¬O0,[f4]=[c5]_¥¬ªL­È¬O1*2=2,[f4]=[c6]¬O0*3=0,µ²ªG­È¬O2
     '[f4]=[c4]_¨ä¥¬ªL­È¬O0,[f4]=[c5]_¥¬ªL­È¬O0*2=0,[f4]=[c6]¬O1*3=3,µ²ªG­È¬O3

     If j * k Then [f9].Cells(j + k - 1) = [f5]
     '¡ô¦pªGjÅܼÆ*kÅܼƤ£¬O 0,´N¥O[f9]¬Û¹ï¦ì¸mÀx¦s®æ­È¬O [f5]
End With
End Sub
µ´¹ï­È¬A©·¸Ìªº­È¬Ý°_¨Ó³£¬O¥¿¼Æ,ÁöµM©|¤£¤F¸Ñ¬°¦ó­n¥[Abs,«á¾Ç¦pªGª¾¹D¤F·|¦^¨Ó¸É¥R
ÁÂÁ«e½ú
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 25# ­ã´£³¡ªL
ÁÂÁ­㴣³¡ªL¤j´£¿ô,¤w¸Ñ¨M,·P®¦
¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

TOP

¦^´_ 24# bhsm

F5 ¬OªÅªº~~~~~~~~~~~~~~

TOP

¦^´_ 23# ­ã´£³¡ªL
·PÁ­㴣³¡ªL¤j±Ð¾É¥t¤@ºØ¤è¦¡,±ß½ú¸Õ¤F¸Õ,µLªkÅã¥Ü¼Æ­È,·Ð½Ð±z¦A¦¸«ü¾É,ÁÂÁÂ

1.rar (11.36 KB)

¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

TOP

        ÀR«ä¦Û¦b : ¸Ü¦h¤£¦p¸Ü¤Ö¡A¸Ü¤Ö¤£¦p¸Ü¦n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD