I have a code for a text box to ensure that the date is entered correctly
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)'check date format
With TextBox1
If Len(.Text) <> 10 Or _
Mid(.Text, 3, 1) <> "-" Or _
Mid(.Text, 6, 1) <> "-" Then
MsgBox "Date format must be mm-dd-yyyy"
Cancel = True
Exit Sub
End If
End With
If Not IsDate(TextBox1) Or Mid(TextBox1, 1, 2) > 12 Then
MsgBox "Please enter a valid date."
Cancel = True
Exit Sub
End If
End Sub
This shows ensures the date is mm-dd-yyyy. Because I dont understand that code in the slightest.. what do i change to ensure the date is written dd-mm-yyyy