ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date format in excel (https://www.excelbanter.com/excel-programming/312653-date-format-excel.html)

Racketman

date format in excel
 
When manually opening a csv file in excel, a cell ("b2") shows the date as
'04/10/2004' (dd/mm/yyyy). When opening this file through a macro using the
following code.
"Workbooks.opnetext filenae:=wmspath$ & "csv\" & datafilename"
The date in cell ("b2") has changed format to '10/04/2004'. (mm/dd/yyyy)
Does anyone know how to stop this date switching, I have checked settings in
regional options with short date format of "dd/mm/yyyy".
Cheers Jonathan

Frank Kabel

date format in excel
 
Hi
in VBA use the format method. e.g.
fname = format(Range("B2"),"dd/mm/yyyy")

--
Regards
Frank Kabel
Frankfurt, Germany

"Racketman" schrieb im
Newsbeitrag ...
When manually opening a csv file in excel, a cell ("b2") shows the

date as
'04/10/2004' (dd/mm/yyyy). When opening this file through a macro

using the
following code.
"Workbooks.opnetext filenae:=wmspath$ & "csv\" & datafilename"
The date in cell ("b2") has changed format to '10/04/2004'.

(mm/dd/yyyy)
Does anyone know how to stop this date switching, I have checked

settings in
regional options with short date format of "dd/mm/yyyy".
Cheers Jonathan



Jonathan[_12_]

date format in excel
 
Hi Frank

Thanks very much for that, I know I could amend it, in
the vb script, but was looking to find the main fix
instead of having to check when writing more macro's.

Cheers
Jonathan

-----Original Message-----
Hi
in VBA use the format method. e.g.
fname = format(Range("B2"),"dd/mm/yyyy")

--
Regards
Frank Kabel
Frankfurt, Germany

"Racketman"

schrieb im
Newsbeitrag news:75E021E9-2179-41B5-8965-

...
When manually opening a csv file in excel, a cell

("b2") shows the
date as
'04/10/2004' (dd/mm/yyyy). When opening this file

through a macro
using the
following code.
"Workbooks.opnetext filenae:=wmspath$ & "csv\" &

datafilename"
The date in cell ("b2") has changed format

to '10/04/2004'.
(mm/dd/yyyy)
Does anyone know how to stop this date switching, I

have checked
settings in
regional options with short date format

of "dd/mm/yyyy".
Cheers Jonathan


.



All times are GMT +1. The time now is 05:27 PM.

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