I want to put today's date (4 November 2018) into a cell in this (dd/mm/yyyy
) format:
04/11/2018
However every attempt so far leads to (mm/dd/yyyy
format):
11/04/2018
Original code is:
Dim sToday As String
sToday = Date
Cells(nCurrentRow, nCurrentColumn) = sToday
What I have tried includes:
Cells(nCurrentRow, nCurrentColumn).Value = sToday
and:
Cells(nCurrentRow, nCurrentColumn).Select
Selection.NumberFormat = "dd/mm/yyyy;@"
and:
sToday = Format(Date, "dd-mm-yyyy")
When I output the string in a message box, it always appears in the desired format: 04/11/2018
Even when I post the date as a plain string in the correct format 04/11/2018
the format still changes!
Windows 10 regional settings are as I require (UK date format).
The cell format is also set to dd/mm/yyyy
.
dd/MM/yyyy
– Reinstate Monica - Goodbye SE Nov 4 '18 at 12:51