+ Reply to Thread
Results 1 to 9 of 9

Find Multiple Instances of Word in Range and Copy All

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Find Multiple Instances of Word in Range and Copy All

    I have the below code which I want to find each instance of "Try" in column B and each time it finds it down as far as B300 then if 2 rows to the right of where it is found equals what's in cell C1, copy the cell one the left of where the "Try" was found and paste it into Sheet3 column AL and the last used row.

    My code below finds the first instance of the word "Try" and copies and pastes correctly but how can I loop it so that it searches through the entire range B2:B300?


    Please Login or Register  to view this content.
    Last edited by ScabbyDog; 01-23-2016 at 09:43 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Find Multiple Instances of Word in Range and Copy All

    Not sure, I believe you have rows and columns mixed up, rows go up and down, columns go left and right.

    Maybe just attach a sample workbook, to stop any more confusion.

  3. #3
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Find Multiple Instances of Word in Range and Copy All

    Quote Originally Posted by davesexcel View Post
    Not sure, I believe you have rows and columns mixed up, rows go up and down, columns go left and right.

    Maybe just attach a sample workbook, to stop any more confusion.
    My above code works perfectly, but stops after it finds the first instance of 'Try'. I just need a loop added that continues down finding all instances of 'Try' in Column B.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Find Multiple Instances of Word in Range and Copy All

    As far as I can see there is a loop, possibly your paste location is the error, is it pasting to the same range each time?

  5. #5
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Find Multiple Instances of Word in Range and Copy All

    Quote Originally Posted by davesexcel View Post
    As far as I can see there is a loop, possibly your paste location is the error, is it pasting to the same range each time?
    If I run numerous times, then it'll paste in the last used cell so it does paste in the first unused cell correctly.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Find Multiple Instances of Word in Range and Copy All

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    To add a file to a new post

    To add a file to an existing post.

  7. #7
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Find Multiple Instances of Word in Range and Copy All

    Final-Sample.xlsm

    Attached sample file showing what I expect Before and After macro is run.

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Find Multiple Instances of Word in Range and Copy All

    Try this,
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Find Multiple Instances of Word in Range and Copy All

    Perfect Dave. Really appreciate the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 10-15-2014, 03:38 PM
  2. Count instances of a certain word in a range
    By Richard Champlin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2014, 04:47 PM
  3. Find a value in a range which may have multiple instances of that value
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2014, 06:08 PM
  4. Find Multiple Instances of a String, copy whatever number value is in next Cell and add it
    By arvind3tthiru in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2013, 11:26 PM
  5. [SOLVED] Calculate SUM, based on multiple instances of a word
    By her.rockstar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-11-2013, 11:23 AM
  6. Replies: 6
    Last Post: 02-06-2013, 07:45 PM
  7. Find and Replace Instances of a Word in a Cel
    By Marx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-01-2006, 08:45 AM

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