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

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

¦^´_ 20# Andy2483
ÁÂÁ±zªº¸Ñ»¡¡AVBA¹ê¦b¤Ó°ª²`¤F¡A§Ú´¿¸ÕµÛ¦Û¤v¸Ñ¨M¡A¦ý¬O¯uªº¡¨¤£·|´N¬O¤£·|¡¨¡A¥u¯à¨Ì±zªºµ{¦¡½X¨Ó¸ÕµÛ²z¸Ñ¡A¯uªº«Ü©¯¹B¦³±zªº¤£§[½ç±Ð¡A¦A¦¸²`²`¤@Áù°`¡A¯uªº«ÜÁÂÁ±z¡C
¦~ÄÖ¤£¤p,¦ý§Ú«Ü·Q¾Ç

TOP

¦^´_ 21# bhsm


        ÁÂÁ«e½ú¦^´_
ÅÞ¿è¬O¥i¥H°V½mªº,¨Ò¦p «pÁy¥Öªº¾Ç¥Í ´N«Ü²Â¾Ç¤F¤Q´X¦~ÁÙ«Ü»{¯uªº¾Ç,¤£©ñ±ó
³o»òÀu½èªº¾Ç²ß¥­¥x«ç±Ë±oÅý ¯uªº¡¨¤£·|´N¬O¤£·|¡¨¦¨¬°¨Æ¹ê©O?
¤@¤Ñ¶i¨B¤@ÂIÂI´N¥i¥H¤F
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

§Q¥Î index ­È¶ñ¥R//
Private Sub Worksheet_Change(ByVal Target As Range)
Dim j%, k%
With Target
     If .Address <> "$E$4" And .Address <> "$F$4" Then Exit Sub
     j = Abs(([e4] = [b4]) + ([e4] = [b5]) * 4)
     k = Abs(([f4] = [c4]) + ([f4] = [c5]) * 2 + ([f4] = [c6]) * 3)
     If j * k Then [f9].Cells(j + k - 1) = [f5]
End With
End Sub

TOP

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

1.rar (11.36 KB)

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

TOP

¦^´_ 24# bhsm

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

TOP

¦^´_ 25# ­ã´£³¡ªL
ÁÂÁ­㴣³¡ªL¤j´£¿ô,¤w¸Ñ¨M,·P®¦
¦~ÄÖ¤£¤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

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

TOP

¦^´_ 27# Andy2483


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

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

        ÀR«ä¦Û¦b : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD