View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond Robin Hammond is offline
external usenet poster
 
Posts: 79
Default Using Nothing and Null

I think this is the general idea.

Nothing applies to an object

Sub
Dim rngCell as range
msgbox (rngCell is nothing) 'should return true
Set rngCell = Range("A1")
msgbox (rngcell is nothing) 'should return false
set rngCell = Nothing 'clears the object

IsEmpty applies to a variable
Dim vTemp as variant
if IsEmpty(vTemp) then ' would be true
vTemp = "Something"
if IsEmpty(vTemp) then ' would be false

Hope that helps,

Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Mikhail" wrote in message
...
What is the difference between Nothing (if Range("A1") is Nothing then

....)
and Null (if IsEmpty(Range("A1") then ...)?
What is better to use with ranges (seems both keywords work)?

Thanks in advance,

Mike510