Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Range.Find skips the first cell ??

Yeah, your solution is the same as mine - except yours is noticibly cleaner.
Despite being disgusted by this behavior I'm sure I can learn to make due
<smirk.

Thanks for your help!



"Dave Peterson" wrote:

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


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
Countif skips cells in range Mainer Excel Discussion (Misc queries) 2 October 20th 09 06:11 AM
How do I set it so my tab key skips to the next cell not 6? twassyouth Excel Discussion (Misc queries) 2 October 15th 07 10:29 PM
How do I set up a function that skips a cell in a fill? clubbhouse Excel Worksheet Functions 8 August 20th 07 04:36 PM
can't tab to next cell skips to end of line? Donna Black Excel Discussion (Misc queries) 2 July 26th 06 11:41 AM
Range.Find skips the first cell ?? Tim Williams Excel Programming 1 July 15th 05 12:22 AM


All times are GMT +1. The time now is 11: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"