VBA IsNull() : macro pour indiquer si une variable ne contient pas de donnée valide

La fonction IsNull permet de réaliser une macro pour indiquer si une expression ne contient aucune donnée valide (Null) dans Excel.

La fonction IsNull

La fonction IsNull suit la syntaxe suivante :

IsNull(variable)

Exemple de variable avec IsNull

La macro

Sub macro()

Dim x, y, z, Check1, Check2, Check3

x = ""
y = Null
z = "Macro"

Check1 = IsNull(x) 'renvoie Faux
Check2 = IsNull(y) 'renvoie Vrai
Check3 = IsNull(z) 'renvoie Faux

MsgBox ("Vérification 1 : " & Check1 & Chr(10) & "Vérification 2 : " & Check2 & Chr(10) & "Vérification 3 : " & Check3)

End Sub