Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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.






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
Date Transfer to userform MBlake Excel Programming 5 May 11th 05 07:55 PM
Date in userform being saved as general not date which affects sor Michael Malinsky[_3_] Excel Programming 0 July 28th 04 06:58 PM
Date Selection Userform Archie[_2_] Excel Programming 2 April 13th 04 07:05 AM
Userform to select start date and end date Johnny B. Excel Programming 0 November 28th 03 05:56 PM
Userform Date validation David Goodall Excel Programming 6 August 19th 03 11:46 PM


All times are GMT +1. The time now is 02:15 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"