try
on error resume next

--
Don Guillett
SalesAid Software
donaldb@281.com
"Pat" <glass_patrick@hotmail.com> wrote in message
news:eb3SGdnFFHA.1476@TK2MSFTNGP09.phx.gbl...
> The following code will return an error if there is nothing to return:
>
> With ActiveSheet
> With ActiveSheet
> Set rng1 = Nothing
> Set rng1C = Nothing
> Set rng1F = Nothing
> On Error Resume Next
> Set rng1C = .Range("Q74:Q1000"). _
> SpecialCells(xlConstants, xlNumbers)
> Set rng1F = .Range("Q74:Q1000"). _
> SpecialCells(xlFormulas, xlNumbers)
> On Error GoTo 0
> If rng1C Is Nothing Then
> Set rng1 = rng1F
> Else
> If rng1F Is Nothing Then
> Set rng1 = rng1C
> Else
> Set rng1 = Union(rng1F, rng1C)
> End If
> End If
> If rng1 Is Nothing Then
> MsgBox "No quantities found"
> Exit Sub
> End If
> End With
>
>
> I need the code to continue executing and ignore the nothing to return
> element.
> Thank you if you can help.
> Pat
>
> P.S. I have only included part of the code which I feel relevant, if more
> clarity is needs I can provide it.
>
>