+ Reply to Thread
Results 1 to 7 of 7

macro that finds variables in one column and enters values if variables found

  1. #1
    Registered User
    Join Date
    02-06-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    5

    macro that finds variables in one column and enters values if variables found

    I'm trying to make a simple macro that searches through a worksheet (if possible a whole workbook) for a long list of words.
    To make it simple let's say the words are:
    cat
    dog
    wombat

    For simplicity's sake let's say it would be searching column A.

    If any of the words are found in column A, the word "check" will be placed column B in the same row it was found in.

    I had found <a href="http://www.ozgrid.com/VBA/find-method.htm">this</a> and thought it may be a starting point for this code.

    Not sure how to proceed, I'm willing to explain further details or even pay for this!

  2. #2
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: macro that finds variables in one column and enters values if variables found

    If you are willing to explain further, why no offer up the information in your initial request?
    How are you planning on supplying the list of words to the macro? Are they contained in a list in the workbook? Are they to be hard coded in the macro itself?

  3. #3
    Registered User
    Join Date
    02-06-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro that finds variables in one column and enters values if variables found

    By "further information" all that I meant was that I may not have been totally clear in my initial post, and I suppose I wasn't =[ .
    I think hardcoding the list of words into the macro would be the easiest, if I ever needed to add or subtract words I could do that in the code. It would also be better as I would like to run this macro in other workbooks as well.

    Any help anyone can provide is greatly appreciated, even just a direction, functions to look into, etc...

  4. #4
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: macro that finds variables in one column and enters values if variables found

    Both of the following assume you have a header row and that you want to loop through allw sheets in the workbook.

    This version allows you to hard code the text into the array:

    Please Login or Register  to view this content.
    This version takes a list from column H and creates a range from the list to be used in the search:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-06-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro that finds variables in one column and enters values if variables found

    Thank you so much! I will test it out tomorrow.

  6. #6
    Registered User
    Join Date
    02-06-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro that finds variables in one column and enters values if variables found

    mdbct, it works! is there any way i can donate to you? do you have a paypal acct? you may pm me

  7. #7
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: macro that finds variables in one column and enters values if variables found

    If you really want to "pay" me, do it with a compliment. You can do that by clicking on the Reputation Scales next to my post. If you want to depart with your money, donate it to your favorite charity.
    Last edited by mdbct; 02-07-2010 at 08:36 AM.

+ 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