Your Programming and Traning Professionals

Excel DATE & ISDATE VBA Function


The Excel Data function is a simple Excel VBA function that will return the current date.  You can also use the function to identify if a variable is a date format.

For Example:

GetDate = Date()
'GetDate would equal something like 11/12/2010

To verify if a variable is a date, you could use the formula ISDATE()

ISDATE will product a true or false result.

Dim getdate As Date
getdate = "1/2/2010"
If IsDate(getdate) = True Then
    MsgBox "The data is an actual date"
End If

This result is true as getdate is an actual date.