How to change the default data reading method for dates

Copper Contributor

Hello everyone, I am encountering a problem when opening web downloaded data by my excel. I have downloaded a csv file from the web, with a column of strings as "dd-mm-yyyy". My PC directly reads them as a date in the format of "dd-mm-yyyy" and displays them as "dd/mm/yyyy", which is correct. However, when I open the same file from my laptop, it reads the strings as "mm-dd-yyyy", and only convert the cells with less than 12 dates value faultly into "mm/dd/yyyy" while remains the others as strings.

 

I have noticed that under the number ribbon, my PC default date location is English (Hong Kong), while my laptop is English (United States). I think that might be the reason for that. Does anyone knows how to change the default setting of the date reading method or write a script for the checking in Macros VBA please?

 

Eg. The original csv: 27-02-2020    12-02-2020

My PC shows as: 27/2/2020 ("d/m/yyyy") 12/2/2020 ("d/m/yyyy") True

My Laptop shows as: 27-02-2020 ("General") 12/2/2020 ("m/d/yyyy") False

 

 

1 Reply

I have just adjusted the programs to be the same region default, and I finally figured out the problem:

When I directly click the link from Chrome or MS Edge, the file downloaded is good, but when I downloaded it by the VBA code Workbooks.Open("link"), it failed and  the date format started to confuse me. Anyone knows how to control the date format reading default of the Workbooks.Open function?