#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit loyso Excel Programming 7 May 3rd 05 02:51 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"