VBA Function: IsDate

The VBA IsDate function returns True if the value is a date (or can be converted to a date) or False if it is not.



Example of Usage

Using the IsDate function to determine if the value entered in the TextBox field is a date:

excel vba userform textbox date isdate

The following event is triggered when the Submit button is clicked and checks if the value in the TextBox field is a date before performing any other action:

Private Sub CommandButton_submit_Click()
    'Check if the field contains a date
    If IsDate(TextBox_date) Then
        MsgBox "Yes, it's a date!"
    End If
End Sub