+ Reply to Thread
Results 1 to 12 of 12

Find text in a range, select said cell. then continue searching in the range from there

  1. #1
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Find text in a range, select said cell. then continue searching in the range from there

    Hello,

    I have found thousands of posts on how to find text (say "DueNow") within a column and then .Select that cell.
    However, I have yet to see a post that will find the next instants of "Due Now" and .Select that cell. and so on and so on.
    The code below works to get to the first instance of "Due Now" within the range, but if i run the code again, it does not move down the column.

    I think it has something to do with excel starts at the top of the row everytime versus starting from the row that is currently selected (say G450).

    I simply want it to continue down the column from whatever row I am currently at.

    Please Login or Register  to view this content.
    I appreciate any help.
    Thank you.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Hi sHutchison & welcome to the forum

    Since you're selecting the cell, try the below ... You can read more about it HERE

    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Thanks nankw83,

    But this won't work because I will not be on the cell when I rerun the code. This would work if it would continue searching the range starting from the row that I'm on.

    Is that possible?

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Please clarify... when you say "starting from the row that I'm on", do you mean the cell in Column A for the row the selected cell is on?
    Last edited by Rick Rothstein; 07-24-2020 at 04:28 PM.

  5. #5
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Any cell in a row that i have changed. I am using this to work through a sheet and make changes from top to bottom.

    I just need a macro that looks for "Due Now" in a range and selects the cell containing it without starting from the top again.

    So if cell U344 has Due Now (the code takes me to that cell), then and I make changes in another cell (maybe cell T360), then when I rerun the code it should start searching down in range U:X from row 360.

    Your suggestion works perfect if I stay in that Range, but I most likely will be in another area of the spreadsheet.

  6. #6
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    That's why I think that I have to tell excel to start searching in the range of U:X, beginning from the active row.

    I hope this helps.

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    I know, but what if the currently selected cell is on the same row but located to the right of a cell with "Due Now" in it... is the code supposed to go back to it or move on to the next cell with "Due Now" in it?

    Also, could a single row contain more than one cell with "Due Now" in it?

    Finally, would it be alright to start from the beginning again whenever Excel is opened? In other words, would it be acceptable for the code to keep moving on as you asked while Excel is open, but if you close Excel and open it again later, the code would start searching from cell A1 onward.

  8. #8
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Thanks Rick,

    1. It can move on to the next Due Now
    2. There will not be more then 1 Due Now on a row
    3. It could start over when I reopen Excel but only if I run the code manually.

    I hope this helps.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    This macro will go through each "Due Now" cell continuing from the last cell found with "Due Now" in it no matter where the active cell is located at the time. Is that what you were asking for initially?
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    I'm getting..

    Run-Time Error 1004
    Application-defined or Object-defined error

    On this line?

    Set LastFoundCell = Columns("A1:A10000").Find("Due Now", LastFoundCell, xlValues, xlWhole, , xlNext, False, , False)

  11. #11
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Hey Rick,

    It runs fine if the Due Now is typed in the cell. However the Due Now is in a formula. I see you have xlValues in the code so I would think it would work?

  12. #12
    Registered User
    Join Date
    08-29-2014
    Location
    Rockford MI
    MS-Off Ver
    2013
    Posts
    8

    Re: Find text in a range, select said cell. then continue searching in the range from ther

    Rick, I see the errors of my ways.
    This code works great!

    Thank you!

+ 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: 3
    Last Post: 08-12-2018, 05:04 PM
  2. Macro to find text from a range in another range and fill a cell accordingly
    By aspadaro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2017, 09:05 AM
  3. [SOLVED] How to find text then select RANGE form the text found to lastrow of Column J
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2014, 02:45 AM
  4. Replies: 1
    Last Post: 02-04-2014, 01:57 PM
  5. [SOLVED] Searching a Range for a Specific Text and put a different text in a different cell
    By AngelAzrael in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-14-2013, 09:25 AM
  6. macro to find text string in cell range and paste in other cell range
    By slearner1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 11:15 AM
  7. Find Text, Select range below, copy, paste to new work sheet
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2011, 07:10 PM

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