Thread
:
Allow code to continue regardless
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Allow code to continue regardless
try
on error resume next
--
Don Guillett
SalesAid Software
"Pat" wrote in message
...
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.
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]