ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to skip in a macro (https://www.excelbanter.com/excel-programming/290746-re-how-skip-macro.html)

Bob Phillips[_6_]

How to skip in a macro
 
Duncan,

Set an object and test it

Dim oFind As Range

Set oFind = Range("A:A").Find("Jellybean")
If Not oFind Is Nothing Then
oFind.Resize(5, 14).Copy _
Destination:=Worksheets("Totals").Range("A7")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Duncan J" wrote in message
...
Hi,
I'm using this code for about 15 products:
Range("A:A").Find("Jellybean").Resize(5, 14).Copy _
Destination:=Worksheets("Totals").Range("A7")
However, sometimes Jellybean is not in the report. How do I make it skip

if it's not present in that report so the macro won't error out?

Thanks




Duncan J

How to skip in a macro
 
Thanks Bob
Worked like a charm.
DJ


All times are GMT +1. The time now is 02:12 AM.

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