Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Text box date format

Does anyone know how you can change american date format to UK englishwhen a
text box = a cell with a date, it displays it in US format.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Text box date format

TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK englishwhen
a text box = a cell with a date, it displays it in US format.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Text box date format

Thanks Bob. I put this in the code for the text box but it hasn't worked.
"Bob Phillips" wrote in message
...
TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK
englishwhen a text box = a cell with a date, it displays it in US format.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Text box date format

Hi Jim,

I am assuming that you require the answer as it is done in VBA code. Is that
correct? If so then the following examples should explain it.

'Date in range A3 set to 3 Aug 2008

'Following displays 8/3/2008 in textbox (US format)
Sheet1.TextBox1.Value = Sheet1.Range("F3")

'Following displays 03 Aug 2008 in textbox
Sheet1.TextBox1.Value = Format(Range("F3"), "dd mmm yyyy")

'Following displays 3/8/2008 in textbox
Sheet1.TextBox1.Value = Format(Range("F3"), "d/mm/yyyy")


If you set a linked cell in the TextBox properties then the Linked Cell must
contain the formatting so that it is a text value not a date value like the
following

=TEXT(DATEVALUE("3 Aug 2008"),"dd mmm yyyy")


In the above formula, DATEVALUE("3 Aug 2008") could simply reference a cell
with an actual date like the following. (Assuming that G3 contains the date 3
Aug 2008)

=TEXT(G3,"dd mmm yyyy")

Note that TEXT function is used on a worksheet and FORMAT function is used
in VBA to achieve the same results.



--
Regards,

OssieMac


"Jim Lavery" wrote:

Thanks Bob. I put this in the code for the text box but it hasn't worked.
"Bob Phillips" wrote in message
...
TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK
englishwhen a text box = a cell with a date, it displays it in US format.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Text box date format

An explanation of what happened/didn't happen would help.

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Thanks Bob. I put this in the code for the text box but it hasn't worked.
"Bob Phillips" wrote in message
...
TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK
englishwhen a text box = a cell with a date, it displays it in US
format.









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Text box date format

Sorry Bob I should hav ebeen more descriptive. The date remained in US
format in the text box
"Bob Phillips" wrote in message
...
An explanation of what happened/didn't happen would help.

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Thanks Bob. I put this in the code for the text box but it hasn't worked.
"Bob Phillips" wrote in message
...
TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK
englishwhen a text box = a cell with a date, it displays it in US
format.









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box date format

Do you have the TextBox linked to the cell via the LinkedCell property? If
so, try unlinking the TextBox (clear the LinkedCell property) and using this
worksheet Change event code to control the contents of the TextBox...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$5" Then
TextBox1.Text = Format$(Target.Value, "dd/mm/yyyy")
End If
End Sub

Change the address string in the If..Then statement to the absolute address
string for the cell you previously had the TextBox linked to. Does doing
this do what you want?

Rick


"Jim Lavery" wrote in message
...
Sorry Bob I should hav ebeen more descriptive. The date remained in US
format in the text box
"Bob Phillips" wrote in message
...
An explanation of what happened/didn't happen would help.

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Thanks Bob. I put this in the code for the text box but it hasn't
worked.
"Bob Phillips" wrote in message
...
TextBox1.Text = Format(CDate(TextBox1.Text), "dd/mm/yyyy")

--
__________________________________
HTH

Bob

"Jim Lavery" wrote in message
...
Does anyone know how you can change american date format to UK
englishwhen a text box = a cell with a date, it displays it in US
format.










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
Need help with converting CUSTOM format/TEXT format to DATE format Deo Cleto Excel Worksheet Functions 6 June 2nd 09 08:14 PM
Convert date from text format to date format Anita Excel Discussion (Misc queries) 3 June 4th 07 11:57 AM
Convert date + time text format to date format Paul Ho Excel Worksheet Functions 2 May 22nd 07 05:47 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


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

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

About Us

"It's about Microsoft Excel"