Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Date in text box reading mm/dd/yy instead of dd/mm/yy

Hi all,

I have a userform with a textbox where a user will input the date. As I am
from Australia, the standard format would be dd/mm/yy. This works ok until I
click the OK button and the data is transferred to the worksheet as
mm/dd/yy.

Can someone tell me if I will need to insert a line of coding in the
userform to convert the date to dd/mm/yy and then transferred to the
worksheet as dd/mm/yy instead of mm/dd/yy.

Thanx in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Date in text box reading mm/dd/yy instead of dd/mm/yy

Whilst Excel handles locale quite well, VBA does not so you will have to
coerce it. This worked for me if the cells were pre-formatted as text

Private Sub CommandButton1_Click()
Range("A1").Value = DateValue(Me.TextBox1.Value)
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Maddoktor" wrote in message
...
Hi all,

I have a userform with a textbox where a user will input the date. As I am
from Australia, the standard format would be dd/mm/yy. This works ok until
I click the OK button and the data is transferred to the worksheet as
mm/dd/yy.

Can someone tell me if I will need to insert a line of coding in the
userform to convert the date to dd/mm/yy and then transferred to the
worksheet as dd/mm/yy instead of mm/dd/yy.

Thanx in advance.



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
Formula not reading date format ziak Excel Discussion (Misc queries) 3 May 20th 10 09:41 PM
Reading Text Sanjay Excel Discussion (Misc queries) 3 July 30th 09 06:32 PM
Copnvert dates reading as Text to a date format Margy Excel Discussion (Misc queries) 5 February 9th 09 06:53 PM
Reading File Name in VB Macro that contains today's date dhstein Excel Discussion (Misc queries) 10 November 13th 08 02:48 AM
date reading formula question Todd Excel Worksheet Functions 1 August 10th 06 05:55 PM


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