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

¦r¦ê¤¤¬Y´X­Ó¦r¤¸Åܦâ

¦r¦ê¤¤¬Y´X­Ó¦r¤¸Åܦâ

½Ð±Ð¦U¦ì¦p¦ó¥i¥H°µªº¨ì!

§Ú³»¦h¥u¯à°µ¨ìÀx¦s®æÅܦâ


Ä´¦p :

   ¿é¤J AAA
   ²Å¦Xªº¦r¦ê111AAA333
   Åã¥Üªº®É­Ô,§â111AAA333¦r¦ê¤¤ªºAAAÅܦâ

A1¿é¤JAAA¡AB1¿é¤J111AAA333
  1. Private Sub CommandButton1_Click()
  2.   On Error Resume Next
  3.     xx = Len([a1])
  4.     yy = Application.Search([a1], [b1])
  5.     Range("B1").Select
  6.     With ActiveCell.Characters(Start:=yy, Length:=xx).Font
  7.         .ColorIndex = 3
  8.     End With
  9. End Sub
½Æ»s¥N½X
YOYO

TOP

³o¬O§Ú¤§«e¼gªºµ{¦¡½X,»yªk¦p¦³¨Ï¥Î¿ù»~,½Ð¦h¥]²[(¦]¬°§Ú¬O¦Û¾Ç)
¶¶«K¦b¦¹·PÁÂyanto913 ªº¨ó§U!!§Ú¦bDEBUG¤¤,¤w¤F¸Ñ§A¼gªº¤è¦¡
¦A½Ð±Ð¤@¤U!!
Application.Search([a1], [b1])¦bEXCEL VBA¥\¯à¯Á¤Þ¦¡°Ñ¦Ò¤â¥U,§Ú§ä¤£¨ì¥Îªk!!
¥i§_»¡©ú¤@¤U³o¥yªº»yªk¤Î¬°¦ó­n¥Î"[]"
Sub «ö¶s4_Click()

   Dim A As String
   
    A = InputBox("¦r  ¦ê", "½Ð ¿é ¤J ¦r ¦ê")
   
    MsgBox A
   
    Cells(1, 5) = A
   
    B = 2
   
    ActiveSheet.Range("I41000").Clear
   
    Do Until InStr(1, Cells(B, 2).Value, A, 1)
     
        B = B + 1
      
       If B >= 100 Then
      
       MsgBox "±z¿é¤Jªº©m¦W¬O¡G   " & A, vbOKOnly + vbCritical, Title:="¬dµL¦¹¦r¦ê"
      
       A = InputBox("½Ð­«·s¿é¤J¦r¦ê")
      
       B = 2
      
       End If
      
     Loop
   
    X = 4
   
    For B = 2 To 100
     
      If InStr(1, Cells(B, 2).Value, A, 1) Then
      
            
         Cells(X, 9) = Cells(B, 1)
         
         Cells(X, 10) = Cells(B, 2)
         
         Cells(X, 11) = Cells(B, 3)
         
         Cells(X, 12) = Cells(B, 4)
         
         XX = Len(Cells(1, 5).Value)

         yy = Application.Search(Cells(1, 5).Value, Cells(X, 10).Value)

         Cells(X, 10).Select

         With ActiveCell.Characters(Start:=yy, Length:=XX).Font
         
           .Bold = True
           
           .ColorIndex = 3

         End With
                              
         X = X + 1
         
      End If
      
    Next
   
End Sub

TOP

³o°ÝÃD­n²o¯A¨ì·j´M¦r¦êªº·j´M¼Ò¦¡°ÝÃD
¥H¦¹¨Ò¨Ó»¡¦pªG·j´Mª½«ü¿é¤JA
¨º­n3­ÓA³£ÅܦâÁÙ¬O²Ä¤@­ÓAÅܦâ?
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-4-13 15:19 ½s¿è

¦^´_ 3# rph
¥[¤W   Application.Search  ªº¨ç¼Æ ¬O¨Ï¥Î¤u§@ªíªº¨ç¼Æ   
¥¿¦¡ªº»yªk¬°  Application.WorksheetFunction.Search
¥i§_»¡©ú¤@¤U³o¥yªº»yªk¤Î¬°¦ó­n¥Î"[]"

[ ] =Application.Evaluate¤èªk
  1. Sub Ex()
  2. MsgBox Application.Evaluate("Sheet1!a1").Address
  3. MsgBox [Sheet1!a1].Address
  4. End Sub
½Æ»s¥N½X

TOP

1.¥ý¦^À³Hsiehª©¤j
§Úªº¤pµ{¦¡´N¥u»{§Ú¿é¤Jªº¦r¦ê,Ä´¦p¿é¤J"A",¨º¦r¦ê¤¤"123AAA444",´N²Ä1­Ó"A"Åܦâ
¦]¬°§Úªºµ{¦¡¥D­n¥\¯à´N¬O¿é¤JKEY¤§«á,´N§ä¥X²Å¦XKEY¤§¸ê®Æ,¨Ã¥B¦C¥X

2.¦A½Ð±Ð¤@¤UGBKEE,§Ú­è¤~RUN¤F§Aªºµ{¦¡½X,MSGBOX¥X²{$A$1ªºµ´¹ï¦ì§}°T®§,³o¼Ë¬O¥Nªí???

3.¤u§@ªí¨ç¼Æ¦b­þ¥i¬dªº¨ì???§Ú¬ÝEXCELªº¨ç¼Æ¸Ì¦³SEARCH³o­Ó¨ç¼Æ

TOP

¦^´_ 6# rph
Address ªº¥Îªk¥i¬Ý VBAªº»¡©ú
VBA ¥i¥Î¤u§@ªí¨ç¼Æ»¡©ú´M§ä¦p¹Ï

TOP

§Ú­è¤~¤w¥h¤F¸Ñ,¤]¤F¸Ñ¤F[ ] =Application.Evaluate¤èªk,·PÁ±zªº»¡©ú!

TOP

¦^´_ 6# rph
  1. Private Sub CommandButton1_Click()
  2. Dim A As Range
  3. fc = InputBox("¿é¤J¦r¦ê", , "A")
  4. s = Len(fc)
  5. For Each A In UsedRange
  6.    k = InStr(A, fc)
  7.    If k > 0 Then A.Characters(k, s).Font.ColorIndex = 3
  8. Next
  9. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ rph ©ó 2011-4-14 11:48 ½s¿è

TO Hsieh
¤µ¤Ñ§Ú¤w±Nª©¥Dªºµ{¦¡½X¶K¨ìEXCEL´ú¸Õ,´ú¸ÕOK(§Ú¦³§â²Ä5¦æªºUSEDRANGE§ï¦¨RANGE("A1:A6"),­n¤£µM·|¦³¿ù»~)
DIM A AS RANGE ´N¬O«Å§iA¬°RANGEª«¥ó  P.S§Ú­è¦³´ú¸Õ,¨S«Å§iµ{¦¡¤@¼Ë¥i¥H¶],¥i§_»¡©ú®t²§??
For Each A In Range("A1:B6") ³o¦æµ{¦¡½X¬O§_¥Nªí±N"A1Àx¦s®æªº­È"©ñ¤J"A",¦A¥h§@§PÂ_,¦A¨Ó´NÅܦ¨"A2Àx¦s®æªº­È"©ñ¤J"A",¥H¦¹Ãþ±À

·PÁÂ!!

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD