+ Reply to Thread
Results 1 to 2 of 2

extend mode with Find Next

  1. #1
    HGood
    Guest

    extend mode with Find Next

    Is it possible to use Extend mode with Find Next? In a macro I'd like to
    start with cursor on A1, then using Find Next, extend the selection down to
    the cell which has my target text in it. But I can't find a way to extend
    the selection all the way down there.

    Any ideas?

    Thanks,

    Harold



  2. #2
    Dave Peterson
    Guest

    Re: extend mode with Find Next

    Maybe something like:

    Option Explicit
    Sub testme()

    Dim FoundCell As Range
    Dim whatToFind As String
    Dim wks As Worksheet

    Set wks = Worksheets("sheet1")

    whatToFind = "SomeWord"

    With wks
    Set FoundCell = .Cells.Find(what:=whatToFind, _
    after:=.Cells(1), LookIn:=xlValues, lookat:=xlWhole, _
    searchorder:=xlByRows, searchdirection:=xlNext, _
    MatchCase:=False)

    If FoundCell Is Nothing Then
    MsgBox "No " & whatToFind & "'s were found"
    Else
    Application.Goto .Range("a1", FoundCell)
    End If
    End With

    End Sub

    I looked for the whole cell and didn't care about matching case.

    HGood wrote:
    >
    > Is it possible to use Extend mode with Find Next? In a macro I'd like to
    > start with cursor on A1, then using Find Next, extend the selection down to
    > the cell which has my target text in it. But I can't find a way to extend
    > the selection all the way down there.
    >
    > Any ideas?
    >
    > Thanks,
    >
    > Harold


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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