VBA IsDate Function

IsDate Description

Returns True if the expression is a valid date. Otherwise, it returns False.

Simple IsDate Examples

Sub IsDate_Example()
    MsgBox IsDate("4/12/2019")
End Sub

This will return True.

MsgBox IsDate("4\12\2019")

Result: False

IsDate Syntax

In the VBA Editor, you can type  “IsDate(” to see the syntax for the IsDate Function:

The IsDate function contains an argument:

Expression: An expression that will be evaluated.

Examples of Excel VBA IsDate Function

examples of various valid date:

MsgBox IsDate("8/22/2019")
MsgBox IsDate("8 22 19")
MsgBox IsDate("Aug 22 19")
MsgBox IsDate("8,22,2019")
MsgBox IsDate("8-22-19")
MsgBox IsDate("8/22")
MsgBox IsDate("8-22")

Result: True

examples of invalid date:

MsgBox IsDate("8.22.2019")
MsgBox IsDate("8\22\2019")
MsgBox IsDate("Aug")
MsgBox IsDate("2019")

Result: False