![]() |
Text Box
How do I write the code for a text box to show a date as dd / mm / yyyy.
I am a little stuck on how to do this? I can get it to show the date but I need it formatted in this way Thanks Greg |
Text Box
Greg,
If it is a textbox on a userform, then something along the lines of: UserForm1.TextBox1.Text = Format(Now(), "dd / mm / yyyy") If it is a textbox from the control toolbox, then put this into a cell, say A1 =TEXT(NOW(),"mm / dd / yyyy") and use =A1 in the textbox. HTH, Bernie MS Excel MVP "Greg" wrote in message ... How do I write the code for a text box to show a date as dd / mm / yyyy. I am a little stuck on how to do this? I can get it to show the date but I need it formatted in this way Thanks Greg |
Text Box
You don't say where the textbox is located or which kind of textbox, but one
suggestion would be: Private Sub Textbox1_Exit() Textbox1.Value = format(cdate(Textbox1.Value),"dd / mm / yyyy") End Sub -- Regards, Tom Ogilvy "Greg" wrote in message ... How do I write the code for a text box to show a date as dd / mm / yyyy. I am a little stuck on how to do this? I can get it to show the date but I need it formatted in this way Thanks Greg |
Text Box
Thanks for your Help
Greg "Tom Ogilvy" wrote in message ... You don't say where the textbox is located or which kind of textbox, but one suggestion would be: Private Sub Textbox1_Exit() Textbox1.Value = format(cdate(Textbox1.Value),"dd / mm / yyyy") End Sub -- Regards, Tom Ogilvy "Greg" wrote in message ... How do I write the code for a text box to show a date as dd / mm / yyyy. I am a little stuck on how to do this? I can get it to show the date but I need it formatted in this way Thanks Greg |
All times are GMT +1. The time now is 09:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com