How to use the VBA ISNULL Function (Syntax + Example)

HomeVBA Functions LIST (Category Wise)How to use the VBA ISNULL Function (Syntax + Example)

The VBA ISNULL function is listed under the information category of VBA functions. When you use it in a VBA code, it evaluates the supplied expression and returns TRUE if it is NULL else FALSE. In simple words, it can check whether the value supplied is NULL or not and returns TRUE or FALSE based on that.

Syntax

IsNull(Expression)

Arguments

  • Expression: An expression that you want to test if it’s a NULL or not.

Example

To practically understand how to use VBA ISNULL function, you need to go through the below example where we have written a vba code by using it:

Sub example_ISNULL()
Range("A1").Value = IsNull("myVar")
End Sub

In the above code, we have used ISNULL to check if the variable myVar is null or not and it has returned TRUE in the result.

Related Functions

ISARRAY | ISDATE | ISEMPTY | ISERROR | ISMISSING | ISNUMERIC | ISOBJECT