View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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