Null Value

lkrznchc

New Member
Joined
Feb 28, 2013
Messages
11
I know this may be a stupid question, but in VBA does Null mean blank? I am looking at using the logic IsNull and am wondering if that is the same logic as =IsBlank() for a cell formula.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Cells on worksheets never contain Null -- the VarType of the Value2 property is either vbString, vbDouble, vbBoolean, vbError, or vbEmpty.

Len(range("a1").value)=0 does not distinguish between an empty cell and a cell that contains a null string.
 
Last edited:
Upvote 0
So, when queries return nulls these are considered vbEmpty?

I always think of these as worksheet cells that contain nulls. As far as the query/table is concerned, they are nulls.
 
Last edited:
Upvote 0
Sorry, I was not clear. In fact I'd strayed off the topic.

The thread was about nulls in VBA. You commented cells on worksheets never contain Null.

I was thinking in a different sphere - I run many queries [database type queries such as via ADO or MS Query, I guess even pivot tables] and have the results in worksheet cells. The queries return nulls: these end up with blank worksheet cells returned from the query. To me these are nulls in worksheet cells but I see now that is only in respect of the query. In the VBA context these are, as you say, not null. They test as vbEmpty. In the context of a query, I can query them and return them using a "field Is Null" criteria.

regards
 
Upvote 0
I don't do queries to speak of, so I don't know; IIRC, you're a wizard at them.

A Variant can have the value Null, but it has to be assigned (an uninitialized Variant is Empty). I expect that's a meaningful result for a query that returns nothing; "no valid data"
 
Upvote 0
cheers

Just noticed out post counts. You're at 9993, this will be 6992 for me. Congrats in advance on the 10000 post milestone :-)
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top