Excel date changed (month and day swapped) after reading and writing with VBA
问题 I wrote two lines of simple VBA codes to read from and write a date to a cell, but unexpectedly the month and day swapped after the run. The steps are: Enter a date "1/11/2017" in the cell A1. The date is now displayed as "01/11/2017". Run the following lines of code: Dim s As String s = Cells(1, 1).value Cells(2, 1).value = s The cell B1 now displays "11/01/2017" with the month and day swapped. My short date format setting in Region in Windows is "dd/MM/yyyy" so the string s stores the value