View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Range.Find skips the first cell ??

I like to start after the last cell in the range and look for the next cell...

Something like:

Dim myRng as range
Dim FoundCell as range

set myrng = worksheets("Sheet1").range("a1:z99")

With myRng
Set FoundCell = .Cells.Find(what:="what to look for", _
after:=.Cells(.Cells.Count), LookIn:=xlValues, _
lookat:=xlWhole, searchorder:=xlByRows, _
searchdirection:=xlNext, MatchCase:=False)
End With

slintz wrote:

It seems that a straight forward Range.Find() call implicitly starts
searching AFTER the first cell in the range, AS IF called as

f = r.Find(after:=r.cells(1,1),...)

This work-around is effective:

f = r.find(after:=r.cells(r.Rows.Count, r.Columns.Count),...)

but it's (obviously) fugly. Am I missing something?


--

Dave Peterson