ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   US - British Dates (https://www.excelbanter.com/excel-programming/421588-us-british-dates.html)

Howard31

US - British Dates
 
I have a Userform where the user enters a date in british format (dd/mm/yyyy)
and the date is then copied to excel. My problem is that excel interperts it
as US dates for example if the user enters 09/12/2008 the vba copies it to
excel as 12/09/2008. I've tried Cstr before i.e Range("A1").Value =
Cstr(TextDate.Value) and also the Format function as in Range("A1").Value =
Format(TextDate.Value,"dd/mm/yyyy"), but non of this seems to do the trick.

--
A. Ch. Eirinberg

Mike H

US - British Dates
 
Try this

mypart = Split(Textdate.Text, "/")
Range("a1").Value = _
DateSerial(mypart(2), mypart(1), mypart(0))

Mike

"Howard31" wrote:

I have a Userform where the user enters a date in british format (dd/mm/yyyy)
and the date is then copied to excel. My problem is that excel interperts it
as US dates for example if the user enters 09/12/2008 the vba copies it to
excel as 12/09/2008. I've tried Cstr before i.e Range("A1").Value =
Cstr(TextDate.Value) and also the Format function as in Range("A1").Value =
Format(TextDate.Value,"dd/mm/yyyy"), but non of this seems to do the trick.

--
A. Ch. Eirinberg



All times are GMT +1. The time now is 03:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com