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
|