Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See if this code helps
'StrDate = Textbox1.Text StrDate = "6/9/08" 'get the 1 or 2 digits before 1st slash and convert to number MonthNum = Val(Left(StrDate, InStr(StrDate, "/") - 1)) 'get the string after the 1st slash StrDate = Mid(StrDate, InStr(StrDate, "/") + 1) 'get the month number before the slash and convert to number DayNum = Val(Left(StrDate, InStr(StrDate, "/") - 1)) 'get the year after the slash YearNum = Val(Mid(StrDate, InStr(StrDate, "/") + 1)) 'add 2000 to year number YearNum = YearNum + 2000 'convert date to serial format SerDate = DateSerial(YearNum, MonthNum, DayNum) 'Print the Date in required format Textbox1.Text = Format(SerDate, "dd-mmm-yy") "tkraju via OfficeKB.com" wrote: Hello,VBA experts how to validate date entries in TextBoxes (on Userform),user wants to enter date values in dd/mm/yy format,entry is must in textbox,after entry and exiting from textbox the textbox entry be displayed in dd-mmm-yy format.(without changing computer's Regional and language settings). -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200806/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date Format for Userform TextBox | New Users to Excel | |||
Date Format in UserForm textbox. | Excel Programming | |||
Copying TextBox entry from one UserForm to another | Excel Programming | |||
Ensuring UserForm Textbox Entry is numeric | Excel Programming | |||
Date Calculation in UserForm TextBox | Excel Programming |