Date Formats

bayles

Board Regular
Joined
Oct 31, 2013
Messages
54
Hi,

We have a spreadsheet that is being used by users in USA where standard date format is "mm/dd/yyyy" and also in Australia where it is "dd/mm/yyyy".

When we first open the spreadsheet before any macros are run the cell with the date in it is "Custom" format "dd/mm/yyyy".

The code below aims to change it to a date format but for the date 3rd June 2018 "03/06/2018" is being changed to "06/03/2018" in files opened by the US users.

Dim rng as Range

Set rng = Range(Sheets("DATA ENTRY").Cells(2, 3), Sheets("DATA ENTRY").Cells(3, 3)) ' CONVERT DATE IN DATA ENTRY FILE

rng.NumberFormat = "dd/mm/yyyy"
rng.FormulaR1C1 = "=DATE(YEAR(RC[-1]),MONTH(RC[-1]),DAY(RC[-1]))"
Range(Sheets("DATA ENTRY").Cells(2, 2), Sheets("DATA ENTRY").Cells(3, 2)).Value = Range(Sheets("DATA ENTRY").Cells(2, 3), Sheets("DATA ENTRY").Cells(3, 3)).Value
rng.ClearContents

Does anyone know how to maintain "dd/mm/yyyy" format even on users computers that have "mm/dd/yyyy" as default?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
When going between these two systems use a format such as "D-MMM-YYYY"
The standard display format, with the asterisk, uses the local system formatting. So opening in USA or Australia, it correctly shows the LOCAL formatted date.
You can use a custom format or formatting that does not begin with an asterisk.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top