ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding cell matches (https://www.excelbanter.com/excel-programming/392344-finding-cell-matches.html)

[email protected]

Finding cell matches
 
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


Trevor Shuttleworth

Finding cell matches
 
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


wrote in message
ups.com...
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





All times are GMT +1. The time now is 11:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com