MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Finding an exact match


Posted by Lewis on December 05, 2001 8:40 AM

Hi,

I am using the following to search for a serial number.

Dim SearchValue As String
If IsError(Cells.Find(What:=SearchValue, After:=ActiveCell, _

The problem is that it does not do an exact match. For example searching for 12 finds the first date 5/12/2001

Is there a way to search for an exact match or restrict my search to a particular range.

Regards

Lewis


Posted by Juan Pablo G. on December 05, 2001 8:50 AM

If you look at your code, you'll see that you have

Lookat:=xlPart

If you change this to xlWhole it will search for an EXACT match.

Juan Pablo G.

Posted by Lewis on December 05, 2001 9:17 AM

Thanks that has fixed it

Lewis