Results 1 to 6 of 6

Setting up a search macro to find multiple words

Threaded View

O0J0E Setting up a search macro to... 03-16-2012, 08:42 AM
mrice Re: Setting up a search macro... 03-16-2012, 09:35 AM
O0J0E Re: Setting up a search macro... 03-16-2012, 12:25 PM
O0J0E Re: Setting up a search macro... 03-16-2012, 02:08 PM
O0J0E Re: Setting up a search macro... 03-16-2012, 03:22 PM
Tinapie Re: Setting up a search macro... 09-19-2013, 05:14 AM
  1. #1
    Registered User
    Join Date
    03-08-2012
    Location
    New Hampshire
    MS-Off Ver
    2010
    Posts
    12

    Setting up a search macro to find multiple words

    Hello, I need some addition help with a search macro.

    What I have
    I currently have a search macro set up the searches column A for what you have typed into H5, if it finds the value in H5 in column A it copies columns A to F and pastes that info into H12- M12 (first it will clear all contents in these cells to avoid showing the wrong results) The macro is written as follows:
      Sub Search()
    Range("H11").CurrentRegion.ClearContents: Range("H11") = "Results"
    FindWhat = (Range("H5"))
    For Each Cell In Range("A2", Range("A" & Rows.Count).End(xlUp))
    If InStr(Cell, FindWhat) <> 0 Then
    Cell.Offset(, 0).Resize(, 7).Copy Range("H" & Rows.Count).End(xlUp).Offset(1, 0)
    End If
    Next Cell
    End Sub

    What I need
    The macro only searches for single values for example if I type in lion I will get all results with lion involved but if I type in angry lion I will show no results even though in column A I have lion, cat, angry, fierce. Also if i type in Lion I will get nothing due to the upper case.
    1. Is there a way to search for both upper and lower case values?
    2. How can I search for multiple words at once that are not right next to each other?

    any help would be greatly appreciated, thanks.

    -Joe.
    Last edited by Leith Ross; 03-16-2012 at 06:13 PM. Reason: Added Code Tags

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