ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Curious IsNull test (https://www.excelbanter.com/excel-programming/338771-curious-isnull-test.html)

Tim[_44_]

Curious IsNull test
 
Why, when my code goes through this segment, is neither message box
displayed?

If IsNull(test) Then
MsgBox "Test is now null"
Else
MsgBox "<" & test.Value & ""
End If


Chip Pearson

Curious IsNull test
 
What data type is 'test'?

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


"Tim" wrote in message
oups.com...
Why, when my code goes through this segment, is neither message
box
displayed?

If IsNull(test) Then
MsgBox "Test is now null"
Else
MsgBox "<" & test.Value & ""
End If




Rowan[_4_]

Curious IsNull test
 
Hi Tim

What is test? Could it be that you have an errorhandler that is trapping an
error and therefore skipping one of the message boxes?

If test is a range then it will never be null. It is Nothing until you set
it and if it is set to a range which contains no data then it's Value
property is Empty.

Hope this helps
Rowan

"Tim" wrote:

Why, when my code goes through this segment, is neither message box
displayed?

If IsNull(test) Then
MsgBox "Test is now null"
Else
MsgBox "<" & test.Value & ""
End If



Tim[_44_]

Curious IsNull test
 
Dim cntNew, test As MSForms.Control

I have discovered part of the problem is that an error handler grabs
control. Let me just investigate this information futher.

Much thanks,
-Tim


Tim[_44_]

Curious IsNull test
 
Ok. Question answered. Many thanks.



All times are GMT +1. The time now is 05:24 AM.

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