Hi,
I am currently working on a VBA code that has a specific button to export a copy of the worksheet in question.
The table has a column for date and time together in this format: dd-mm-yyyy hh:mm AM/PM;@
The import of the data into this worksheet works fine, however when exporting the worksheet via VBA code for some reason it keeps changing the year on the column.
for example it starts out correctly (left column and becomes the right column after export)
However the original file still has the correct data and only the newly generated workbook is showing the incorrect information.
The code I use to export is:
While trying to debug the issue, I found that when I manually go to save the file instead of using the above code it works perfectly fine so I am really confused what could be going wrong.
I am currently working on a VBA code that has a specific button to export a copy of the worksheet in question.
The table has a column for date and time together in this format: dd-mm-yyyy hh:mm AM/PM;@
The import of the data into this worksheet works fine, however when exporting the worksheet via VBA code for some reason it keeps changing the year on the column.
for example it starts out correctly (left column and becomes the right column after export)
24-06-2020 03:21 PM | 24-06-2016 03:21 PM |
24-06-2020 03:18 PM | 24-06-2016 03:18 PM |
24-06-2020 03:18 PM | 24-06-2016 03:18 PM |
However the original file still has the correct data and only the newly generated workbook is showing the incorrect information.
The code I use to export is:
VBA Code:
Application.ScreenUpdating = False
ThisWorkbook.Sheets("Account Summary").Copy Before:=wb.Sheets(1)
ActiveWorkbook.SaveCopyAs (filePath & FileNames & " - System Summary.xls")
ActiveWorkbook.Close 0
Application.ScreenUpdating = True
While trying to debug the issue, I found that when I manually go to save the file instead of using the above code it works perfectly fine so I am really confused what could be going wrong.