ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't test Range for Nothing (https://www.excelbanter.com/excel-programming/364556-cant-test-range-nothing.html)

Peter Chatterton[_4_]

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



Chip Pearson

Can't test Range for Nothing
 
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

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





Ebbe[_3_]

Can't test Range for Nothing
 
Try: If rRange Is Nothing Then

Ebbe

"Peter Chatterton" skrev i en meddelelse
...
Public Sub testNullRange
Dim rRange As Range
Set rRange = Nothing ' yes, in debugger
If IsNull( rRange ) Then _
MsgBox "DOESN'T COME HERE"
End Sub





Peter Chatterton[_4_]

Can't test Range for Nothing
 
Thanks guys.

Peter

"Ebbe" k wrote in message
...
Try: If rRange Is Nothing Then

Ebbe

"Peter Chatterton" skrev i en meddelelse
...
Public Sub testNullRange
Dim rRange As Range
Set rRange = Nothing ' yes, in debugger
If IsNull( rRange ) Then _
MsgBox "DOESN'T COME HERE"
End Sub








All times are GMT +1. The time now is 11:37 PM.

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