+ Reply to Thread
Results 1 to 3 of 3

Search between here and word

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    End of the World, USA
    MS-Off Ver
    EXCEL 2007
    Posts
    111

    Search between here and word

    How do I search "LAUNCH" between the selected cell's row and the next occurence of the cell with "APPL"?

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Search between here and word

    Search in any column? Will LAUNCH and APPL be in the same column?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Search between here and word

    I am going to take what the OP said very literally.

    Sub miscFind()
    Dim ws As Worksheet:    Set ws = Sheets("Sheet1")
    Dim applFind As Range, launchFind As Range
    
    Set applFind = ws.Range(Selection, ws.UsedRange.SpecialCells(xlCellTypeLastCell)).Find(What:="APPL", LookIn:=xlValues, Lookat:=xlWhole)
    
    If Not applFind Is Nothing Then
        Set launchFind = ws.Range(Selection, applFind).Find(What:="LAUNCH", LookIn:=xlValues, Lookat:=xlWhole)
            If Not launchFind Is Nothing Then
                MsgBox ("LAUNCH was found in cell " & launchFind.Address)
            Else
                MsgBox ("LAUNCH was not found")
            End If
    Else
        MsgBox ("APPL was not found")
    End If
        
    End Sub

+ 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: 2
    Last Post: 08-05-2013, 04:45 PM
  2. Replies: 13
    Last Post: 08-04-2011, 09:41 AM
  3. Replies: 1
    Last Post: 01-25-2011, 10:50 PM
  4. How to search for a word in a column and have entire row opaque once word is found
    By copleyr in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-04-2009, 07:11 PM
  5. search for a specific word and copy the word and the preceeding words until a comma
    By DHANANJAY in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-31-2005, 09:10 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