Perform FIND Starting from the beginning of the Range

1

1clncc

when searching within a specificed range

*****************************************************
Set c = range("Postcode").find(.....etc.....)
if c is nothing then
....it didn't find anything............
end if
*****************************************************

it seems the find will start at the 2nd row of the Range, skipping the
first one.

1) How to code the search for the entire range?

2) where to find the complete descriptive parameters for the Find
operations.
(e.g. (What:=sVal, _
LookIn:=xlValues, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

More?
 
D

Dave Peterson

#1. I like to start with the last cell in the range and find the next
occurance. Since I'm starting with the last one, the next one found can be the
first cell in the range.

with worksheets("sheet9999")
with .range("a:a")
set foundcell = .cells.find(what:="whattofind", _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)
end with
end with

Note that if you don't specify these options, then both excel and VBA will use
the last settings that were used--either in VBA or in code. It's better to
always specify everything.

#2. Try VBA's help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top