Textbox format with date

cnu nagula

Board Regular
Joined
Aug 28, 2008
Messages
83
Dear friends,

please help me,

i need a code for textbox1, which should format for date input only "dd/mm/yyy", and the number input is like 19012011 after entering this, the textbox should convert this after pressing TAB key or clicking in another box to 19/01/2011 for excel 2007. please help in this regard

thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
try this way
Code:
Private Sub TextBox1_AfterUpdate()
TextBox1.Value = Format(TextBox1.Text, "##/##/####")
End Sub

but the number must be entered with 8 digits
like your example 19012011
 
Upvote 0
Thank you, its working,

but, the textbox is accepting more than 8 digits, it should be accept for only 8 digits.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,283
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top