emailing
11-28-2007, 05:42 AM
Hi everybody, looking for some support on the following:
A user form is used to enter data into a sheet. With
Private Sub txtDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(txtDate.Text) Then
MsgBox "Enter valid date format: dd.mm.yy"
'Cancel = True
End If
End Sub
only data that is recognised as Date is allowed in the form. However, is there a possibility to specify the allowed format of the date even more, i.e. that only the format dd.mm.yy is accepted by the control? Furthermore, if the year yy is entered, Excel asks if I mean 19xx or 20xx. Can I standardise that somehow so that everything with 9y is automatically converted on the sheet to 199y, and everything else to 20yy?
Initially I was trying to use the normal Cells Formatting and Data Validation tools from Excel, but it seems that works only properly when I enter the data directly on the sheet, not when I enter them with a user form. Or is there a way to use them with a user form?
Thanks for your help in advance!
A user form is used to enter data into a sheet. With
Private Sub txtDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(txtDate.Text) Then
MsgBox "Enter valid date format: dd.mm.yy"
'Cancel = True
End If
End Sub
only data that is recognised as Date is allowed in the form. However, is there a possibility to specify the allowed format of the date even more, i.e. that only the format dd.mm.yy is accepted by the control? Furthermore, if the year yy is entered, Excel asks if I mean 19xx or 20xx. Can I standardise that somehow so that everything with 9y is automatically converted on the sheet to 199y, and everything else to 20yy?
Initially I was trying to use the normal Cells Formatting and Data Validation tools from Excel, but it seems that works only properly when I enter the data directly on the sheet, not when I enter them with a user form. Or is there a way to use them with a user form?
Thanks for your help in advance!