+ Reply to Thread
Results 1 to 3 of 3

Looping until it reaches a cell containing a certain text.

  1. #1
    Registered User
    Join Date
    04-30-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Looping until it reaches a cell containing a certain text.

    I need to select a range of cells until it reaches a cell with a certain text.

    The selection starts from the moment it finds the word "Reds" and ends when it finds the text "Yellows".

    Here's what I've come up with so far:

    Workbooks.Open Filename:=strML
    Sheets("Margin Leakage").Select
    Cells.Find("Reds", After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select

    Do
    Selection.End(xlDown).Select
    Loop Until ActiveCell = "Yellows"

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Looping until it reaches a cell containing a certain text.

    if you search Reds you can not find Yellows, explain better your goal, attach a sample file.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Looping until it reaches a cell containing a certain text.

    Try this code:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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