![]() |
Userform Date
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. |
Userform Date
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. |
Userform Date
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. |
All times are GMT +1. The time now is 12:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com