title: How to validate if a textbox is in the correct date format?
body: <p>I have a UserForm where in a TextBox if user inputs a date format other than <code>dd/mm/yyyy</code> then an error message will pop up after clicking the submit button. Here is what I have so far, it only formats an invalid date input to dd/mm/yyyy but does not display the validation:</p>
  
  <pre><code>If IsDate(Me.DOBTextBox.Value) Then
      Me.DOBTextBox = Format(Me.DOBTextBox.Value, "dd/mm/yyyy")
  
  ElseIf Not IsDate(Me.DOBTextBox.Value) Then
      MsgBox "Please enter a valid date format dd/mm/yyyy", vbCritical
      DOBTextBox.SetFocus
      Exit Sub
  End If
  </code></pre>