+ Reply to Thread
Results 1 to 9 of 9

VBA to enter a word, find said word in string of column & copy to another column

  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    VBA to enter a word, find said word in string of column & copy to another column

    I've looked throughout the forums over the last few hours and haven't found a solution, so I thought I would post and see if someone could help.

    I have a database of upwards of 10000 rows. I would like a VBA macro that will do the following...

    1. Open a text box to have the user enter a keyword.

    2. Search for all instances of that text string in column E of the active worksheet.

    3. If the text string is found, copy that keyword to the same row in column W. If there is already text in column W it is to be overwritten.

    I don't think it should be too difficult, but it is giving me fits.

    Thanks in advance.

    Mike

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA to enter a word, find said word in string of column & copy to another column

    Try this

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: VBA to enter a word, find said word in string of column & copy to another column

    when I try that I get

    Run-time error '424':

    Object required

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA to enter a word, find said word in string of column & copy to another column

    My mistake,I mistype d,
    Try this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: VBA to enter a word, find said word in string of column & copy to another column

    Error is fixed, but not getting data that I'm looking for because I didn't explain myself properly

    If the keyword is "bank", it needs to find any cell in column E that contains the work "bank". So if the cell is "Bob's Bank", it would put "bank" in cell W of that row.

    Thanks

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA to enter a word, find said word in string of column & copy to another column

    Hmmm... Try this,

    Please Login or Register  to view this content.
    I can already see the next question...

  7. #7
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: VBA to enter a word, find said word in string of column & copy to another column

    I changed one line, as I only want the keyword to appear in column W, so it now reads

    c02.Offset(, 18) = c01

    Now the only problem is it only returns one value. I need it to return each occurance.

    Is that the question that you had forseen?

    Mike

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA to enter a word, find said word in string of column & copy to another column

    Quote Originally Posted by tuneloon View Post
    Is that the question that you had forseen?
    Mike
    LOL, Yes it was.
    Give this a whirl.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: VBA to enter a word, find said word in string of column & copy to another column

    Awesome. Greatly appreciate your time and patience.

    Thanks again

+ 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