Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
HGood
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mode Function with Criteria DaveShoe Excel Worksheet Functions 1 April 6th 05 06:22 PM
Using the Find tool in EXCEL TK Excel Worksheet Functions 2 February 11th 05 08:51 PM
How do I find a mode while disregarding a specific cell value? glasskit Excel Worksheet Functions 1 January 25th 05 08:47 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 11th 05 12:45 AM
coverting answer from Radian mode to degree mode Xmastrzman Excel Worksheet Functions 1 November 10th 04 05:45 PM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"