Finding from a range

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

Guest

I am using Excel 97.

I have a range which is named "status"

When the criteria is matched below I am wanting to place it in different
places on a spreadsheet, but it doesn't always work particularly when there
are similiarities in the team name.

For example:

If team = Range("Status").Find("Mansfield Town 2002") Then
'do something
End if

If team = Range("Status").Find("Mansfield Town 2003") Then
'do something
End if

If team = Range("Status").Find("Mansfield Town") Then
'do something
End if

Can anyone offer me some code which is a more reliable way of picking up the
correct team?

Thanks
 
If team = Range("Status").Find("Mansfield Town 2002", Lookat:=xlWhole) Then

See if that narrows it down. Or try Application.WorksheetFunction.Match

Mike F
 

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