+ Reply to Thread
Results 1 to 5 of 5

[SOLVED] Searching a cell with multiple words

  1. #1
    Registered User
    Join Date
    12-20-2010
    Location
    Southampton, England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Thumbs up [SOLVED] Searching a cell with multiple words

    [SOLVED] Hi. I posted a problem on another forum (computing.net), and got a part resolution.

    Basically, i have a piece of code that does the following:

    1 - Sheet 1 Row 1 contains Column Headings.
    2 - Sheet 2 is the destination sheet for the copied rows.
    3 - You want the same Column Headings on Sheet 2 that are on Sheet 1.
    4 - Sheet 3 Column A contains the list of names to search for, starting in A2.

    Before running the following code, place the list of Names to be searched for in Sheet 3 Column A, starting in A2.

    I suggest running the code in a backup copy of your workbook since macros can not be undone.

    Please Login or Register  to view this content.

    My further issue is with point 4 above. The code assumes that the cell in sheet 1 only contains a single word (i.e. a list of surnames for example). But i need the code to search through a paragraph that is contained in the cell and return the match values to sheet 2. (For example, instead of just looking at the 1st word or a single word in the cell in sheet 1, it scans the whole cell for the word, and once the word is matched, the whole row is returned to sheet 2). The list of words in sheet 3 will be single words (i,e, surnames)

    I'm not sure if i am explaining it correctly, but hopefully someone can pick this up and modify the code above.

    am happy to send over an example spreadsheet if required.

    Thanks in advance
    Last edited by nervous_pilchard; 12-22-2010 at 06:52 AM. Reason: [SOLVED]

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Searching a cell with multiple words

    Hello nervous_pilchard,

    Welcome to the Forum!

    If you have a sample workbook you can post, it would make things easier. Does this workbook include all the words you want to search for?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-20-2010
    Location
    Southampton, England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Searching a cell with multiple words

    hi. i have attached the spreadsheet. sheet 1 contains typical data from a call logging helpdesk.

    There is a list of servers in sheet 3. I want to match any servers against the data in sheet 1.

    To make the code work, i have put 2 server names in rows 8 and 17 in sheet 1 (column D)to show how it picks up values where there is only one word, and places them into sheet 2 when you run the macro.

    So, what i need to happen, no matter where the server name sits in the cell, that it matches and puts the row in sheet 2.

    If you could also make it search through column B and Column I as well for the same criteria (server name), that would be brilliant.

    hope you can make it work!!
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,241

    Re: Searching a cell with multiple words

    Hi,
    Try changing the xlWhole to xlPart in your code and see if that does what you want.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    12-20-2010
    Location
    Southampton, England
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Searching a cell with multiple words

    Hey - thanks Marvin - you're a star. it seems such a simple modification, i feel like kicking myself!

    but then i suppose you have to know what to change to be able to make the change!

    thanks once again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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