View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Date format changes when inputed from user form

The problem is with text that looks like a date using the user's windows
regional settings short date order (mdy or dmy or ...).

If your program sees
1/2/3
in a cell, excel will use whatever shortdate format order that the user is using
to parse the entry.

If it's mdy, you'll end up with Jan 2, 2003
If it's dmy, you'll end up with Feb 1, 2003
If it's ymd, you'll end up with Feb 3, 2001

And if the text box looks like:
31/12/2008
and the user is using mdy order, then you'll end up with a string--it won't even
be a date.

I guess if you always know that the order in the textbox is dmy, you could parse
the entry into 3 pieces and create a real date from that.

But I don't know how you would know what the user meant when an ambiguous string
is entered.



Lynz wrote:

David Biddulph wrote:
Format/ Cells/ Number/ Date and choose an appropriate date format
or
Format/ Cells/ Number/ Custom if you want to use a less standard option.
--
David Biddulph

"Lynz" wrote in message
...
Hi, I have a user form which contains text boxes into which I type the
date in format dd/mm/yy. However when I click on the enter button and the
data is entered onto my spread sheet the date enters as mm/dd/yy. I can
get it to enter in the correct format if I use a calendar to add the date
but I dont want to do this If I can help it. Is there an easy solution to
this problem. I have spent hours trying to get it right but nothing Ive
tried works.
Thank you for any assistance
L



Thank you for the quick reply, I have tried Formating as date, text and
custom and if I put 10/12/08 in my text box it still comes out as
12/10/08 on my spread sheet.
L


--

Dave Peterson