Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steve
I use the BeforeUpdate event like this Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) With Me.TextBox1 If IsDate(.Text) Then .Text = Format(.Text, "dd mmm yy") Me.Label1.Caption = "" Else Cancel = True Me.Label1.Caption = "Date required" End If End With End Sub It allows the user to enter the date in any format they like, but changes it to your format. If they don't enter a valid date, it doesn't let them leave the textbox and displays a message in an adjacent label that the entry isn't valid. -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com Steve_G wrote: I want to ensure that an input to a textbox in a userform is in date format either dd/mm/yy or dd mmm yy. Can anyone help ? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to validate input based upon values in two other cells | Excel Discussion (Misc queries) | |||
Restrict-Filter-Limit-Validate user input in Excel | Excel Discussion (Misc queries) | |||
Validate textbox entry | Excel Programming | |||
How can I validate data input by macros? | Excel Programming | |||
Validate Textbox entry | Excel Programming |