VBA IsDate Function

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021

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

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as

Learn More!

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples