application.match Returns what

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can not find any documentation on application.Match method
what is the proper syntax, what does it return
bagno = Search String
rng = "range to lookup"
I wish to return the the row of a found item or return a null if not found
in a certain range or would you reccomend find instead
 
Ben

It's the same syntax as the worksheet function.

Match(bagno,RangeObject,TrueOrFalse)

so an example might be

x = Application.Match(bagno,Sheet1.Range("A1:A10"),False)

See also, here

http://www.dicks-blog.com/archives/2004/09/24/the-worksheetfunction-method/

Match will return the row relative to the range. If you provide
Range("E50:E60"), and Match returns 1, it's really row 50. If you want the
actaul row, use the Find method

Dim rFound As Range

rFound = Sheet1.Range("E50:E60").Find(What::=bagno)

If Not rFound Is Nothing Then
x = rFound.Row
End If

More info on Find
http://www.dicks-blog.com/archives/2004/03/29/the-find-method/
 

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

Back
Top