IsNull Function is to check whether an expression contains no valid data (Null). The return value in Boolean either True or False. If we assigned specific variables with Null then the result is True else False.
Syntax : IsNull(expression) , Return : True/False
Refer below example:
VBA Vode:
Option Explicit
Sub Examples_IsNull()
Dim StrVarA, StrVarB, StrVarC
StrVarB = ""
StrVarC = Null
Debug.Print IsNull(StrVarA) ' Returns False.
Debug.Print IsNull(StrVarB) ' Returns False.
Debug.Print IsNull(StrVarC) ' Returns True.
End Sub
Sub Examples_IsNull()
Dim StrVarA, StrVarB, StrVarC
StrVarB = ""
StrVarC = Null
Debug.Print IsNull(StrVarA) ' Returns False.
Debug.Print IsNull(StrVarB) ' Returns False.
Debug.Print IsNull(StrVarC) ' Returns True.
End Sub
Note: StrVarA we don't assigned anything, StrVarB as empty and StrVarC is Null.
Microsoft Reference-Isnull-functionOther Reference-Isnull-function
Practice makes perfect. Thank You.
excel training beginners
coding in vba
excel training online
visual basic for applications
No comments:
Post a Comment