Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I have a userform where a date is entered in a text box (e.g. 01/12/05). On submit the date is entered into a cell which is formatted dd-mmm-yy (01-Dec-05). The problem is that when the date is transferred into the cell it reads 12-Jan-05. Is there any way within the code for the userform or textbox to ensure that the date is transferred across UK style rather than US style? Apologies if that has been covered but I couldn't see it anywhere. Thanks. Paul. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Paul
Datevalue will consider the local settings on the computer. Try Private Sub CommandButton1_Click() Dim Dt As Date If IsDate(TextBox1.Text) Then Dt = DateValue(TextBox1.Text) Sheets(1).Range("D2").Value = Dt End If End Sub HTH. Best wishes Harald "Paul Brown" skrev i melding ... Hi all, I have a userform where a date is entered in a text box (e.g. 01/12/05). On submit the date is entered into a cell which is formatted dd-mmm-yy (01-Dec-05). The problem is that when the date is transferred into the cell it reads 12-Jan-05. Is there any way within the code for the userform or textbox to ensure that the date is transferred across UK style rather than US style? Apologies if that has been covered but I couldn't see it anywhere. Thanks. Paul. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald,
Many thanks - works a treat. "Harald Staff" wrote in message ... Hi Paul Datevalue will consider the local settings on the computer. Try Private Sub CommandButton1_Click() Dim Dt As Date If IsDate(TextBox1.Text) Then Dt = DateValue(TextBox1.Text) Sheets(1).Range("D2").Value = Dt End If End Sub HTH. Best wishes Harald "Paul Brown" skrev i melding ... Hi all, I have a userform where a date is entered in a text box (e.g. 01/12/05). On submit the date is entered into a cell which is formatted dd-mmm-yy (01-Dec-05). The problem is that when the date is transferred into the cell it reads 12-Jan-05. Is there any way within the code for the userform or textbox to ensure that the date is transferred across UK style rather than US style? Apologies if that has been covered but I couldn't see it anywhere. Thanks. Paul. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date Transfer to userform | Excel Programming | |||
Date in userform being saved as general not date which affects sor | Excel Programming | |||
Date Selection Userform | Excel Programming | |||
Userform to select start date and end date | Excel Programming | |||
Userform Date validation | Excel Programming |