View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default match vs .find? What's better/preferred?

I like the .find better.

And I'd make sure that all the parms are specified in the .find command.

AB wrote:

Hi All,

I'm writing a code to do list reconciliation, i.e., the code would
cycle through one list of account numbers and look for a match in 2nd
list and do some stuff if match found. The match always needs to be
exact.

I usually in my codes use the .find xlwhole method - something along
the lines:
dim r as long
dim c as object
set c=myrange.find MyVal, xlwhole ...

if not c=nothing then r=c.row
...
to get the row of the same account in the 2nd list.
Currently users are using a worksheetfunction Match to do the same
thing but just manually.

So, I was about to substitute that manual practice with a code and use
the .find instead of the appliation.worksheetfunction.match (or
application.match) but before I do that I thought i'd rather check
with experts here whether the .find xlwhole is in no way inferior to
the Match(Range,Val,0) function currently utilized.
The searched/matched values might be both Integers and also Strings
(rather long ones - maybe 20-30 chars) - does the string lenght make
any difference?

Any considerations appreciated!


--

Dave Peterson