VBA - IsDate Function



A Function, which returns a Boolean value whether or not the given input is a date.

Syntax

IsDate(expression)

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   msgbox("Line 1 : " & IsDate("Nov 03, 1950"))
   msgbox("Line 2 : " & IsDate(#01/31/20#))
   msgbox("Line 3 : " & IsDate(#05/31/20 10:30 PM#))
End Sub

When you execute the above function, it produces the following output.

Line 1 : True
Line 2 : True
Line 3 : True 
vba_date_time.htm
Advertisements