Find text in worksheet and copy adjacent value to another worksheet

  • Hi, I have been trying to figure this out on my own by looking through the forums but I haven't been able to get my code to work the way I want to. My code below IS working but it is stopping at the first value it finds. I need it to continue searching the worksheet until it finds all matching values. The worksheet will be constantly changing so the code/search needs to be dynamic.


    Here is what I'm trying to do:

    • Search all visible rows in column A on worksheet "Offer Setup Tracker" for text "PROCESSING DATE:"
    • If it finds "PROCESSING DATE:", copy the adjacent cell value in column B
    • Paste that copied value in the next available row in column O on worksheet "2013 Totals"


    I have attached my file here if it helps. I also put my desired result (a list of dates) in column O on the "2013 Totals" tab.


    I have my code in the Workbook_Open slot because I want it to run every time I open the workbook.


    Can anyone help? Thanks very much.
    forum.ozgrid.com/index.php?attachment/51508/

  • Re: Find text in worksheet and copy adjacent value to another worksheet


    Hi, are you saying to replace that code with the last part of mine? So the code would now look like this:




    Let me know if I misinterpreted, but if that's what you meant it looks like that's doing the same thing as my original code was. The output on the "2013 Totals" tab is still just showing the first Processing Date found, it's not going through the worksheet and finding all matches.

  • Re: Find text in worksheet and copy adjacent value to another worksheet


    hello,
    I will need to see the whole sub
    example

  • Re: Find text in worksheet and copy adjacent value to another worksheet


    Hi, it looks like the code that you provided in post #4 works great! The only change I made was to add the xlCellTypeVisible to LookInR so it skipped hidden rows in the search. Thank you so much, I really appreciate it!!

  • Re: Find text in worksheet and copy adjacent value to another worksheet


    your welcome thanks for posting
    it can be done with out macros
    by modifying the array formula


    {=IF(ISERROR(INDEX(Sheet1!$A$1:$C$7,SMALL(IF(Sheet1!$B$1:$B$7=$C$1,ROW(Sheet1!$B$1:$B$7)),ROW(1:1)),3)),"",INDEX(Sheet1!$A$1:$C$7,SMALL(IF(Sheet1!$B$1:$B$7=$C$1,ROW(Sheet1!$C$1:$C$7)),ROW(1:1)),3))}

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!