I am using the following code to validate the text being entered into a text box in my userform.
Private Sub TXTdatefirstlayout_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TXTdatefirstlayout.Value) Then
TXTdatefirstlayout.Value = Format(TXTdatefirstlayout.Value, "dd/mmm/yyyy")
Else
MsgBox "Please enter a date. DD/MM/YYYY"
Cancel = False
End If
End Sub
The validation works however when the user clicks on save the date is shown in in the corresponding cell on my worksheet is in USA format (MM/DD/YYYY) not UK format (DD/MM/YYYY). I have checked the cell format on my worksheet and is is set to the UK format.
I am thinking is it anything to do with the "IsDate" part of the above formula.
Any help would be much appreciated.
Thanks
Private Sub TXTdatefirstlayout_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TXTdatefirstlayout.Value) Then
TXTdatefirstlayout.Value = Format(TXTdatefirstlayout.Value, "dd/mmm/yyyy")
Else
MsgBox "Please enter a date. DD/MM/YYYY"
Cancel = False
End If
End Sub
The validation works however when the user clicks on save the date is shown in in the corresponding cell on my worksheet is in USA format (MM/DD/YYYY) not UK format (DD/MM/YYYY). I have checked the cell format on my worksheet and is is set to the UK format.
I am thinking is it anything to do with the "IsDate" part of the above formula.
Any help would be much appreciated.
Thanks