I have a SaveAs VBA code that is assigned to a button. Right now it saves to a directory folder that never changes and the file name looks like this:
JS_09-12-2022.xlsm
Here is the VBA that does this:
ActiveWorkbook.SaveAs Filename:="K:\DAT\John Smith\" _
& "TYO_" & Format(Now(), "MM-DD-YYYY") & ".xlsm"
So it saves it to John Smith's folder and I do this so that the directory is static and then later at the end of the year I will have to organize the files and throw it in a 2022 folder manually within John's folder.
Is there a way so that this file can go into the current year folder based off the file name year, which it will always pull the current because of the Format(Now() function, so that I won't have to keep organizing manually or make changes to the VBA every year so that it goes into the folder I want?
Thanks
JS_09-12-2022.xlsm
Here is the VBA that does this:
ActiveWorkbook.SaveAs Filename:="K:\DAT\John Smith\" _
& "TYO_" & Format(Now(), "MM-DD-YYYY") & ".xlsm"
So it saves it to John Smith's folder and I do this so that the directory is static and then later at the end of the year I will have to organize the files and throw it in a 2022 folder manually within John's folder.
Is there a way so that this file can go into the current year folder based off the file name year, which it will always pull the current because of the Format(Now() function, so that I won't have to keep organizing manually or make changes to the VBA every year so that it goes into the folder I want?
Thanks