Finding cell matches

N

nectarinesupreme

Hi, I got the Cells.Find line by recording the Macro so I don't really
understand how the code works. Basically I'm just copying a cell from
one spreadsheet and going to the other and trying to find it in there.
It's working fine when it's able to find a matching cell, but it comes
up with an error when it doesn't. All I want is to be able to stop it
when it doesn't come up with a match without the error message. Any
suggestions? Thanks ahead of time for the help.

Selection.Copy
x = ActiveCell
Windows("VOD Master List as of 06-19-07.xls").Activate
Cells.Find(What:=x, After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
 
T

Trevor Shuttleworth

Maybe:

On Error Resume Next ' switch off error check
Cells.Find(What:=x, After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
On Error Goto 0 ' switch on error check

Regards

Trevor
 

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