+ Reply to Thread
Results 1 to 3 of 3

found and insert

Hybrid View

  1. #1
    Registered User
    Join Date
    11-18-2007
    Posts
    29

    found and insert

    A..................................B
    aluminium dec.................
    cotton jan.....................
    soybean feb..................right
    oil dec
    palm nov
    rice dec........................right
    etc

    ok i need a macro if found soybean wording on row A, then B insert "right". if found rice wording on row A, then B insert "right".

    how should i code thank

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Assuming that your data stars in A1 then try

    Sub bbb()
      wrdarr = Array("soybean", "rice")
      Set srcharr = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
      
      For i = LBound(wrdarr) To UBound(wrdarr)
        Set findit = srcharr.Find(what:=wrdarr(i))
        If Not findit Is Nothing Then
          
          firstadd = findit.Address
          Do
            findit.Offset(0, 1).Value = "right"
            Set findit = srcharr.Find(what:=wrdarr(i), after:=findit)
          Loop Until findit.Address = firstadd
        End If
      
      Next i
    End Sub
    HTH

    rylo

  3. #3
    Registered User
    Join Date
    11-18-2007
    Posts
    29
    thank a lot

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1