,

VBA IsDate() : macro pour indiquer si la variable est une date

La fonction IsDate permet de réaliser une macro pour indiquer si une variable est une date dans Excel.

La fonction IsDate

La fonction IsDate suit la syntaxe suivante :

IsDate(variable)

Exemple de macro avec IsDate

La macro

Sub macro()

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

x = « 26/03/2020 »
y = « 26.03.2020 »
z = « 2020-03-26 »

Check1 = IsDate(x)
Check2 = IsDate(y)
Check3 = IsDate(z)

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

End Sub