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

[µo°Ý] VBAµ{¦¡¹J¨ì²Ä¤@­Ó­ÈÂ^¨ú°ÝÃD

[µo°Ý] VBAµ{¦¡¹J¨ì²Ä¤@­Ó­ÈÂ^¨ú°ÝÃD

A1:A25 ¬°¶R½æ»ù®æ
B1:B10 ¤º®e³£¬O:¶R
©Ò¥H§Ú¥u§ì¨ú²Ä¤@­Ó¶R(B1)¡A±NA1ªº»ù®æ¶K¦bC1¡AB2:B10³£¤£ºÞ
B13:B15¤]¬O¶R¡A©Ò¥H¤£ºÞ
B20:B25¤º®e³£¬O:½æ
©Ò¥H§ì¨ú²Ä¤@­Ó½æ(B20)¡AA20ªº»ù®æ¶K¦bC20 ¡AB21:B25³£¤£ºÞ
¨Ì¦¹Ãþ±À¡AVBAµ{¦¡¼g¤£¥X¨Ó¼g¤F«Ü¤[...³Â·Ð°ª¤âÀ°¦£¤@¤U©Î«üÂI!
©Î¬Ohttp://tw.knowledge.yahoo.com/question/article?qid=1713051300303

¦^´_ 1# ³Ì°ª¾÷±K
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub EX()
  3.      EX_¶R½æ "¶R"   ' "¶R" ½Ð­×¥¿
  4.      
  5.      'EX_¶R½æ "½æ"
  6.      
  7. End Sub
  8. Sub EX_¶R½æ(¶R½æ As String)      '«ü©w°Ñ¼Æ(¶R½æ)ªº«¬ºA¬°¦r¦ê
  9.     With Range("b:b")            'ª«¥ó: BÄæ½d³ò
  10.         With .Find(¶R½æ, After:=.Cells(.Count), LOOKAT:=xlWhole)
  11.              'Find(·j´M)( °Ñ¼Æ(¶R½æ), BÄ橳³¡¶}©l, xlWhole:Àx¦s®æ¤º®e§¹¥þ¬Û¦P))
  12.             .Offset(, 1) = .Offset(, -1)
  13.         End With
  14.     End With
  15. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

·PÁ§Aªº«üÂI¡C
²Ä¤@­Ó¶R¦³¥X²{»ù®æ¡A¤§«á²Ä¤@­Ó½æ¦³¥X²{»ù¿ú¡C
¤§«á¤S¹J¨ì«Ü¦h­Ó¶Rªº²Ä¤@­Ó¶R¡A´N¨S¦³»ù¦ì¤F¡C½æ¤]¬O@@

TOP

¦^´_ 3# ³Ì°ª¾÷±K
¤§«á¤S¹J¨ì«Ü¦h­Ó¶Rªº²Ä¤@­Ó¶R¡A´N¨S¦³»ù¦ì¤F¡C½æ¤]¬O@@
1#¦³³o¬q¬ÛÃöªº¦r¥y¶Ü? ¤S¤£ªþ¤WÀɮשιϥܨӻ¡©ú.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

³o¼Ë¶Ü...."
§A³oºØ±Ô­z­n¤£¬O§Ú­è¦n¤Ó¶¢¤~Ãi±o¬Ýʨ

  1. Sub TEST()
  2. Dim a()
  3. a() = ActiveSheet.Range("A1:B" & [B65536].End(xlUp).Row).Value
  4. Cells(1, 3) = a(1, 1)
  5. For s = 2 To UBound(a)
  6. If a(s, 2) <> a(s - 1, 2) Then Cells(s, 3) = a(s, 1)
  7. Next
  8. End Sub
½Æ»s¥N½X

TOP

Sub T20130515_1()
Dim xR As Range, J%, K%, T$
For Each xR In Range([A1], [A65536].End(3))
¡@¡@T = xR(1, 2):¡@¡@J = InStr("¶R½æ", T)
¡@¡@If T <> "" And J > 0 And J <> K Then xR(1, 3) = xR: K = J
Next
End Sub

²¤¹L¢ÐÄæªÅ®æ¤Î¨ä¥L¦r¤¸¡A¥uÀË´ú¡e¶R¡D½æ¡f¨â¦r¬O§_¦³§ó´«¡A
¥ç§Y¡A¡e¶R¡D½æ¡f¨â¦r¤£³sÄò®É¤]¥i§PÂ_¡A
¢Ù­È·|«O¯d¤W¤@­Ó¦r¬O¡e¶R¡f©Î¡e½æ¡f¡A¦A»P¢Ø­È¤ñ¹ï¡A§Y¥i§PÂ_¡I

TOP

        ÀR«ä¦Û¦b : ¤£­n¤p¬Ý¦Û¤v¡A¦]¬°¤H¦³µL­­ªº¥i¯à¡C
ªð¦^¦Cªí ¤W¤@¥DÃD