JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 516
- Office Version
- 365
- Platform
- Windows
Hi All,
for the past several months, I have been using the following code to insert a date or any missing dates:
The date format, as set by windows 11 is dd-mm-yyyy - no probelm
But yesterday, because we have clicked over to the 1st Dec, the date is now being inserted as mm-dd-yyyy.
I don't understand why the format has changed.
I have tried to use various other format combinations, such as
sht.Range("A" & iRow).NumberFormat = "dd,mmm,yyyy", but in doing so, another test that checks that the last date in the table <> todays date now fails, resulting in
sht.Range("A" & iRow) = Date being added over and over again.
I can probably solve the inserting multiple times problem by copying the date format from the previous cell prior to doing test, but I would prefer to understand and fix this issue rather than put a bandaid on it.
Any direction is greatly appreciated.
thanks in advance
for the past several months, I have been using the following code to insert a date or any missing dates:
VBA Code:
If sht.Range("A" & iRow) <> Date Then
iRow = iRow + 1
sht.Range("A" & iRow) = Date
End If
The date format, as set by windows 11 is dd-mm-yyyy - no probelm
But yesterday, because we have clicked over to the 1st Dec, the date is now being inserted as mm-dd-yyyy.
I don't understand why the format has changed.
I have tried to use various other format combinations, such as
sht.Range("A" & iRow).NumberFormat = "dd,mmm,yyyy", but in doing so, another test that checks that the last date in the table <> todays date now fails, resulting in
sht.Range("A" & iRow) = Date being added over and over again.
I can probably solve the inserting multiple times problem by copying the date format from the previous cell prior to doing test, but I would prefer to understand and fix this issue rather than put a bandaid on it.
Any direction is greatly appreciated.
thanks in advance