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

[µo°Ý] ½Ð°ÝExcel¤U©Ô¿ï³æ,¿ï¾Ü«á¦Û°ÊÂà¨ì©Ò»Ý­¶­±ªºVBA¸Ó¦p¦ó¼g

[µo°Ý] ½Ð°ÝExcel¤U©Ô¿ï³æ,¿ï¾Ü«á¦Û°ÊÂà¨ì©Ò»Ý­¶­±ªºVBA¸Ó¦p¦ó¼g

¥»©«³Ì«á¥Ñ lky12345 ©ó 2024-1-3 18:13 ½s¿è

½Ð°Ý¦bExcelÀx¦s®æ¤¤,³]©w¤U©Ô¿ï³æ,¦A¸ÓÀx¦s®æ¿ï¾Ü«á¦Û°ÊÂà¨ì©Ò»Ý­¶­±«ü©wÄæ¦ìªºVBA¸Ó¦p¦ó¼g?
¦b(sheet1)AÄ椤ªºÀH¾÷Äæ¦ì¤W,¥u­n¤U©ÔÂI¿ï"¦C¦L"«á«hÂà¦Ü(sheet2)­¶­±«ü©wÄæ¦ì,
¦p(sheet1)AÄ椤¦³¿ï¾Ü2­Ó¦C¦]®É,«h¥X²{msg box´£¿ô,
«ö¤U½T©w«á.¦^¨ì­ì¸ê®Æ®æ¤W
ÁÂÁÂ

¦^´_ 1# lky12345


    ÁÂÁ½׾Â,ÁÂÁ«e½úµoªí¦¹¥DÃD
«á¾ÇÂǦ¹©«½m²ßIJµo»PCountIf()¨ç¼Æ,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò

¤u§@ªí¼Ò²Õ:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim N%
With Target
   If .Column = 1 And .Rows.Count = 1 Then
      N = Application.CountIf([A:A], "¦C¦L")
      If N > 1 Then MsgBox "AÄ榳 " & N & " ­Ó¦C¦L": Exit Sub
      If N = 1 Then
         Sheets(2).Activate
         '~~Âà¦Ü(sheet2)­¶­±«ü©wÄæ¦ì
      End If
   End If
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 2# Andy2483
·PÁ¤j¤jªº¦^ÂÐ,¦]¬°­Ó¤H¹ïVBA¤]¤£¬O«Ü¼ô±x
©Ò¥HÁٽФj¤j¨ó§UÀ°¦£,ÁÂÁÂ
²{¦bªº°ÝÃD¬O§Ú¶ñ¤Jvba¤¤«o¥X²{¥H¤U°T®§
½Ð°Ý¬O­þÃä¥X¿ù,½Ð¦A«ü¾É,ÁÂÁÂ

TOP

¦^´_ 3# lky12345


    ³oºI¹Ïµe­±¬O¦b¤@¯ë¼Ò²Õ
³oµ{¦¡½X¬OIJµo¨Æ¥ó¡A©Ò¥H­n©ñ¤J¤u§@ªí¼Ò²Õ¡AÀx¦s®æ­È§ïÅܮɷ|¦Û°Ê°õ¦æ
©Ò¥H½Ð¦bVBA¸Ì±N´å¼Ð²¾¨ì±ý´Ó¤Jªº¤u§@ªí¤U§Ö«ö¨â¤U¡A±Nµ{¦¡½X´Ó¤J«á´N¥i¥H¨ìªí®æ´ú¸Õ¤@¤U
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 4# Andy2483
ÁA¸Ñ¤F,·PÁ¤j¤jªº«ü¾É,ÁÂÁÂ

TOP

¦^´_ 5# lky12345
¤j¤j§A¦n
¤£¦n·N«ä,¨Ï¥Î«á¦³­Ó°ÝÃD´N¬O¦pªGAÄ椤¦³Åã¥Ü"¦C¦L"·Æ¹«¥u­nÂI¨ìAÄ椤¥ô¦ó¦ì¸m,«h·|¦Û°ÊÂà¨ìsheet2
½Ð°Ý³o¦³¿ìªk§ïµ½¶Ü?
ÁÂÁÂ

TOP

¦^´_ 6# lky12345

Sheets(2).Activate
³o¬O¸õ¨ì²Ä2¤u§@ªíªº·N«ä
¨ãÅ骺­n¸õ¨ì²Ä2¤u§@ªí°µ¤°»ò¨Æ¡H¥i¦A¨ãÅ骺»¡©ú©Î¤W¶Ç½d¨ÒÀÉ
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 7# Andy2483
¤j¤j§A¦n
¬OÂà¨ìsheet2«á´N¥ÑÂI¿ï¶i¦æ©Ò»Ý­nªº¦C¦L
ÁÂÁÂ
«Ü·PÁ¦³±zªº¨ó§U,³o¼Ëªº¥\¯à¤w¸g«Ü¦n¤F,ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ liaovba ©ó 2024-1-13 10:46 ½s¿è

¦^´_ 3# lky12345


      N = Application.CountIf([A:A], "¦C¦L")  这¨½ªºN¬O读¨ú¤F¾ã¦C¡A¦pªG§A·Q«ü©w­S围¡A¥i¥H§ï变这¨½ªºA:Aªº­È¡A¦p¦ó§ï为A1:A10

TOP

¦^´_ 9# liaovba
¦nªº,ÁÂÁ¤j¤jªº«ü¾É

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD