Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tungana,
Bob's code worked for me. I could reproduce your result if I employed US date settings on my system and I entered the date as 04/06/08. However, to enter the date 4th June 2008, a US user would type 6/04/08 and a European user would type 4/6/08. In either case, Bob's code would provide the the required (June) date in dd-mmm-yy format, as requested. --- Regards. Norman "TUNGANA KURMA RAJU" wrote in message ... Mr.Bob,Your code hasn't given me desired results.I entered a date value in TextBox1, 04/06/08(what I mean 4thJune2008),it converted to 06-Apr-08.I want result 04-Jun-08. "Bob Phillips" wrote: I would use the AfterUpdate event and just check that it is a date, let them enter it however they want, and reform at it Private Sub TextBox1_AfterUpdate() With Me.TextBox1 If IsDate(.Text) Then .Text = Format(CDate(.Text), "dd-mmm-yy") Else MsgBox "Invalid date entry" .SelStart = 0 .SelLength = Len(.Text) .SetFocus End If End With End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "tkraju via OfficeKB.com" <u16627@uwe wrote in message news:855a96bfe9e31@uwe... thank you Bob.Working fine ! one more question. how to validate date entries in TextBoxes (on Userform),user wants to enter date values in dd/mm/yy form,after entry and exiting from textbox the textbox entry be displayed in dd-mmm-yy format. Bob Phillips wrote: With Me.TextBox2 If .Text < "" And _ (Not IsNumeric(.Text) Or _ Val(.Text) Me.TextBox1.Text) Then MsgBox "Invalid value" .SelStart = 0 .SelLength = Len(.Text) .SetFocus Exit Sub End If 'OTHER CODE End With Mr.Rick Rothstein gave me correct vb code for testing two textbox for (equal)values. [quoted text clipped - 15 lines] or corrects the entry by putting exact values as in TextBox1. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200806/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Textbox validation | Excel Programming | |||
textbox validation | Excel Programming | |||
textbox value validation | Excel Programming | |||
Textbox validation | Excel Programming | |||
textbox validation | Excel Programming |