Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
controlling date entry in a text box
We have a form where the user enters the date a sample was taken. The
date is then pasted into a worksheet column that has been formatted as a date in the x/xx/xx format. If the user types x/xx/xxxx (2003 not 03) the date does not appear correctly in the worksheet. How can I force dates to be entered to the x/xx/xx format when typed into the data entry form? OR How can I check the format of the text box (txtDateSampled.text) after it has been typed on the form to see the format, and change it to the format of the destination worksheet column (entered with 4 digits for the year instead of the 2 we need?? something like: If txtdateSampled.text has 4 digits for the year then make txtDateSampled have 2 digits for the year. End If I thought of using right or mid BUT could not think of a simple way to do it other than a long complicated If statement. I know there must be an easy way. Any help would be greatly appreciated. Thanks, BB ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
controlling date entry in a text box
varMyResult = Format(txtDateSampled.text,"dd/mm/yy")
Obviously you can use your own format string ("x/xx/xx" will not work though!) P "captbluefin" wrote in message ... We have a form where the user enters the date a sample was taken. The date is then pasted into a worksheet column that has been formatted as a date in the x/xx/xx format. If the user types x/xx/xxxx (2003 not 03) the date does not appear correctly in the worksheet. How can I force dates to be entered to the x/xx/xx format when typed into the data entry form? OR How can I check the format of the text box (txtDateSampled.text) after it has been typed on the form to see the format, and change it to the format of the destination worksheet column (entered with 4 digits for the year instead of the 2 we need?? something like: If txtdateSampled.text has 4 digits for the year then make txtDateSampled have 2 digits for the year. End If I thought of using right or mid BUT could not think of a simple way to do it other than a long complicated If statement. I know there must be an easy way. Any help would be greatly appreciated. Thanks, BB ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
controlling date entry in a text box
Thank you's to Phobos for the quick answer!!!!
------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validate date entry in a text box. | Excel Discussion (Misc queries) | |||
Creating and Controlling a User data Entry Sheet | Excel Discussion (Misc queries) | |||
Convert Text Entry to Date Format | Excel Discussion (Misc queries) | |||
Controlling text in an Excel worksheet | Excel Worksheet Functions | |||
Controlling cell selection during data entry | Excel Programming |