![]() |
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 |
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 |
All times are GMT +1. The time now is 10:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com