Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using TEXT and &TEXT - display numbers with commas, underline text | Excel Discussion (Misc queries) | |||
Text does not display in "Text boxs" and when wrapping text in a c | Excel Discussion (Misc queries) | |||
merged cells into one text cell, size varies dependant on text dat | Excel Discussion (Misc queries) | |||
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit | Excel Programming | |||
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' | Excel Programming |