Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Using Nothing and Null

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if is null Marge Excel Discussion (Misc queries) 7 June 30th 09 01:11 AM
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
COUNTIF says Null = Blank but Blank < Null Epinn Excel Worksheet Functions 4 October 25th 06 08:03 PM
cell value based on null/not null in another cell spence Excel Worksheet Functions 1 February 18th 06 11:49 PM
When value is NOT Null sbigelow Excel Worksheet Functions 4 October 7th 05 10:12 AM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"