ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Date Format (https://www.excelbanter.com/excel-programming/400728-help-date-format.html)

Dan V[_2_]

Help with Date Format
 
Hi guys

I have a sheet which opens up 5 other sheets in turn to obtain data.

4 of the sheets have info in columns next to a date column

(eg)

07/11/2007 : xxx : xxx
07/11/2007 : xxx : xxx

But when my VB opens the sheets the dates change from

07/11/2007 (UK) to 11/07/2007 (US).

I am using nothing other than "Workbooks.Open Filename:=FPATH & BO_TEMP" to
open the file. (FPATH and BO_TEMP are variables defined earlier in the code).

Any ideas on why this is?
Thanks!

eAlchemist

Help with Date Format
 
Dan,

I think that what you're encountering is a regional setting on your computer
(or maybe in Excel). Excel stores a date as a "date". The format that the
date shows up in is dependent on the default on your system.

Chris

--
Chris Farkas
Excel/Access Developer
http://www.eAlchemy.biz


"Dan V" wrote:

Hi guys

I have a sheet which opens up 5 other sheets in turn to obtain data.

4 of the sheets have info in columns next to a date column

(eg)

07/11/2007 : xxx : xxx
07/11/2007 : xxx : xxx

But when my VB opens the sheets the dates change from

07/11/2007 (UK) to 11/07/2007 (US).

I am using nothing other than "Workbooks.Open Filename:=FPATH & BO_TEMP" to
open the file. (FPATH and BO_TEMP are variables defined earlier in the code).

Any ideas on why this is?
Thanks!


Dan V[_2_]

Help with Date Format
 
That's what I thought, however, opening the sheet on it's own and the dates
are in UK format - open the same sheet using VB in the master sheet and the
dates are in US format... ?????

"eAlchemist" wrote:

Dan,

I think that what you're encountering is a regional setting on your computer
(or maybe in Excel). Excel stores a date as a "date". The format that the
date shows up in is dependent on the default on your system.

Chris

--
Chris Farkas
Excel/Access Developer
http://www.eAlchemy.biz


"Dan V" wrote:

Hi guys

I have a sheet which opens up 5 other sheets in turn to obtain data.

4 of the sheets have info in columns next to a date column

(eg)

07/11/2007 : xxx : xxx
07/11/2007 : xxx : xxx

But when my VB opens the sheets the dates change from

07/11/2007 (UK) to 11/07/2007 (US).

I am using nothing other than "Workbooks.Open Filename:=FPATH & BO_TEMP" to
open the file. (FPATH and BO_TEMP are variables defined earlier in the code).

Any ideas on why this is?
Thanks!


Lonpuz

Help with Date Format
 
Try this out. It might be a way around your issue.

Reference the date in a corresponding column.
Format the new column to the "US" date format.
Hie it if necessary.
Use that column when referencing data in your macro.

Does it revert back to the UK date?


"Dan V" wrote:

That's what I thought, however, opening the sheet on it's own and the dates
are in UK format - open the same sheet using VB in the master sheet and the
dates are in US format... ?????

"eAlchemist" wrote:

Dan,

I think that what you're encountering is a regional setting on your computer
(or maybe in Excel). Excel stores a date as a "date". The format that the
date shows up in is dependent on the default on your system.

Chris

--
Chris Farkas
Excel/Access Developer
http://www.eAlchemy.biz


"Dan V" wrote:

Hi guys

I have a sheet which opens up 5 other sheets in turn to obtain data.

4 of the sheets have info in columns next to a date column

(eg)

07/11/2007 : xxx : xxx
07/11/2007 : xxx : xxx

But when my VB opens the sheets the dates change from

07/11/2007 (UK) to 11/07/2007 (US).

I am using nothing other than "Workbooks.Open Filename:=FPATH & BO_TEMP" to
open the file. (FPATH and BO_TEMP are variables defined earlier in the code).

Any ideas on why this is?
Thanks!



All times are GMT +1. The time now is 04:35 PM.

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