I have a 2D array and have to print parts of it to a sheet, when I do print it to a sheet most dates appear exactly as they do in the locals window. Some of them don't instead appearing as US Date
Sub ConvertDates()
With Range("G1:G76")
.NumberFormat = "dd/mm/yyyy"
.TextToColumns Destination:=Range("G1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False,
_
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
End With
End Sub
If I change the format inside of excel it just rearranges the date into the UK format but the date is wrong. EG 11/06/2019 is transposed from the array as 06/11/2019 but 13/06/2019 is transposed from the array as 13/06/2019 as it should be. Reformatting the cell inside excel has zero effect, it just changes the format of the date it already decides is correct in the US format.
IF i run VBA code to change the format, it accepts the reformat and now displays the correct date. WTF?? See Convertdates() BUT, if I alter the convertdates() code to numberformat = "dd/mm/yyyy" it will display the incorrect date??
if you need the array code I can show it, but this is bizarre.
the dates this anomaly occurs with are 10,11,12 out of a possible range of 10,11,12,13,14,15,16