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

[µo°Ý] ½Ð±ÐÃö©ó³o¬q¥N½XªººÃ´b¡H

[µo°Ý] ½Ð±ÐÃö©ó³o¬q¥N½XªººÃ´b¡H

³o­Ósub¹Lµ{ªº·N«ä¬O±Nsheet4Àx¦s®æa1¨ìa500ªº©Ò¦³¥]§t2ªºÀx¦s®æ´À´«¬°Àx¦s®æªº­È¬°5¡A§ÚªººÃ´b¥D­n¬O¦bdo...while ³o­Ó»yªk¶ô¤¤¡A°²³]§ä¨ì¤F²Ä¤@­Ó¥]§t2ªºÀx¦s®æ¡A¨º»ò´N¶i¤Jdo...while ¹Lµ{ ³o¼Ëªº¸Ü cªº­È³Q´À´«¬°5 ¨Ï¥Îset c=.findnext(c)ªº¸Ü ³o¼Ë¤£´NÅܦ¨¤F§ä5¤F¶Ü¡H¡H ¦Ó¤£¬O§ä2¤F¡H¡H¦ý¬O¬°¤°»òµ{¦¡°õ¦æªºµ²ªG¬O¥¿½Tªº¡H¡H¦Ó¤£¬O¦b§ä¨ì²Ä¤@­Ó¬O2ªºÀx¦s®æ«á¡A±NÀx¦s®æªº­È´À´«¬°5¡AµM«á¦AÄ~Äò§ä5©O¡H¡H³Â·Ð¹ïVBA»yªk¼ô±xªº«ü±Ð¤@¤U¤£¬Æ·P¿E¡I
  1. Sub t1()
  2.   Dim c As Range
  3.   Dim firstaddress As String
  4. With Worksheets("Sheet4").Range("a1:a500")
  5.     Set c = .Find(2, LookIn:=xlValues)
  6.     If Not c Is Nothing Then
  7.         firstaddress = c.Address
  8.         Do
  9.             c.Value = 5
  10.             Set c = .FindNext(c)
  11.         Loop While Not c Is Nothing And c.Address <> firstaddress
  12.     End If
  13. End With
  14. End Sub
½Æ»s¥N½X
ss

·PÁ´£¥Ü, Åý§Ú¸Õ¸Õ
ss

TOP

¦^´_ 1# sunnyso
Range.FindNext ¤èªk
¥Î Find ¤èªk¶}©l¶i¦æ´M§ä«á¡A¥Î¥»¤èªkÄ~Äò¸Ó´M§ä§@·~¡C¥»¤èªk´M§ä¬Û²Å¦X¦P¤@±ø¥óªº¤UÀx¦s®æ¡A¨Ã¶Ç¦^¥Nªí¸ÓÀx¦s®æªº Range ª«¥ó¡C¥»¤èªk¤£¼vÅT¿ï©w½d³ò©Î¥Ø«eÀx¦s®æ¡C
§A¥i¥ý¥Î¥\¯àªí¤¤ªº´M§ä¥ý¿é¤J¤@­Ó·j´M
µM«áÃö³¬´M§ä¹ï¸Ü¤è¶ô
µM«á¦A­«·s±Ò°Ê´M§ä¡A¬Ý¬Ý¥Lªº´M§ä¥Ø¼Ð¬O§_¹w³]¦¨¤W¤@¦¸´M§ä¥Ø¼Ð
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD