Can't test Range for Nothing

P

Peter Chatterton

Public Sub testNullRange
Dim rRange As Range
Set rRange = Nothing ' yes, in debugger
If IsNull( rRange ) Then _
MsgBox "DOESN'T COME HERE"
End Sub
 
C

Chip Pearson

Don't use IsNull. Instead, use Is Nothing.

Dim rRange As Range
Set rRange = Nothing ' yes, in debugger
If rRange Is Nothing Then
MsgBox "rRange is Nothing"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top