View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default UK to US date format

VBA is US Centric. If you work with the date serial number (the way dates
are stored) rather than the string representation of the date, you shouldn't
have a problem. If you mean Userform when you say "form", then convert the
string date in the text box to a date serial number using cDate. This
should pay attention to your regional settings.

Dim dtDate as Date
dtDate = cDate(textbox1.text)

as an example.
--
Regards,
Tom Ogilvy



"David.Wilson " wrote in
message ...
I have a macro that reads;
- data from a form, and writes it to a central data sheet
- and another macro that can retrieve the data and present it on the
form again.

In both macros the date is set as "dd-mmm-yy" format. However I am
having a problem when there is a date such as
05-Jul-04. The 05 and the 07 of the day and month keep getting
transposed so the date turns into 07-May-04 (!!!).

Other dates (I guess ones where the day value is bigger than 12), seem
fine. The network and applications at my work are set to UK date
format, so why are these values changing over to US format?


---
Message posted from http://www.ExcelForum.com/