Vbanullstring, empty, ""

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi can anyone explain what is refered to as a 0 value, blank value "" and empty value i.e nothing in that cell.

I have seen scenarios where people say null string or empty string, or empty but not empty "".

Can anyone please explain which is what and it referes to in vba/excel

Thank you
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

So if im getting right

A nullstring or vbanull string is
"" or 0 value
Is nothing in vba referes to a 0 or blank value
Isblank on a spreadsheet is if the cell has nothing
Totally empty
Isempty in vba is the same thing
 
Upvote 0
Hi,

So if im getting right

A nullstring or vbanull string is
"" or 0 value
Is nothing in vba referes to a 0 or blank value
Isblank on a spreadsheet is if the cell has nothing
Totally empty
Isempty in vba is the same thing


Is that correct?
 
Upvote 0
No.

vbNullString is a compiler constant that refers to a zero-length string. A cells with a formula that returns a null string ("") has the same value as vbNullString.

Empty is the state of an uninitialized Variant, or one that is explicity set to Empty. IsEmpty(Range("A1").Value) or VarType(Range("A1").Value) = vbEmpty tests whether a cell is empty, equivalent to =IsBlank(A1) from the UI. Empty means just that -- no formula, no null string, de nada.

VBA performs lots of type conversions, so Range("A1").Value = vbNullString returns True if A1 is empty only because Empty converted to a string is a null string.
 
Upvote 0
No.

vbNullString is a compiler constant that refers to a zero-length string. A cells with a formula that returns a null string ("") has the same value as vbNullString.

Empty is the state of an uninitialized Variant, or one that is explicity set to Empty. IsEmpty(Range("A1").Value) or VarType(Range("A1").Value) = vbEmpty tests whether a cell is empty, equivalent to =IsBlank(A1) from the UI. Empty means just that -- no formula, no null string, de nada.

VBA performs lots of type conversions, so Range("A1").Value = vbNullString returns True if A1 is empty only because Empty converted to a string is a null string.

AAAAHHHH now that makes sense.

So VBNullString is "" however it also sets it to true if is genuinely empty or blank.

I can also check to see if the cell is empty (no "") by using isempty which will ignore ""?

One last one (what is Nothing) referred to in VBA?

Thank YOu
 
Upvote 0
Nothing is the value of an uninitialized object variable, or one that has been explicitly set to Nothing.
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,332
Members
449,155
Latest member
ravioli44

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