MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Textboxes to look like this dd/mm/yyyy


Posted by Randycas on July 17, 2001 9:16 AM

Hi there,

Is there any code that I can use so that my text box would look like the following?

--/--/----
where the dashes would mean dd/mm/yyyy and the cursor would skip over the slashes going straight to the dashes.

Thanks

Cas


Posted by GREGC on July 17, 2001 9:26 AM

textbox = format(textbox,"dd/mm/yyyy")

Posted by Randycas on July 18, 2001 6:00 AM

Excuse my ignorance but i have 3 textboxes and i have pieced together some code to make this form work and i am not quite sure where i should enter the code you gave me. should i put the code for each textbox. I tried selecting the textbox i want to format and it says Private sub textbox2_change(). I added the code but it did not work. Please help

Posted by gregc on July 18, 2001 8:00 AM

Change the sub name from textbox2_change() to textbox2_afterupdate().