PatrickSchmidt
New Member
- Joined
- Apr 30, 2014
- Messages
- 25
Hello,
I made a macro to save a file with todays date in a folder. I'll be doing this everyday and I don't want the folder to fill with workbooks. I would like to keep yesterdays and delete the file dated the day before yesterday.
Also If anyone can give me a tip for adding in holidays to the workday function I'd really appreciate it.
Any help is greatly appreciated. Thank you!
Excel 2010
my variables and code that are not working:
Sub CleanUp()
Dim TwoDays
TwoDays = Format(WorksheetFunction.<wbr>WorkDay(Date, -2), "yyyy mm-dd")
Kill "C:\Test\ & TwoDays & TheRestOfFileName.xlsx"
End Sub
I made a macro to save a file with todays date in a folder. I'll be doing this everyday and I don't want the folder to fill with workbooks. I would like to keep yesterdays and delete the file dated the day before yesterday.
Also If anyone can give me a tip for adding in holidays to the workday function I'd really appreciate it.
Any help is greatly appreciated. Thank you!
Excel 2010
my variables and code that are not working:
Sub CleanUp()
Dim TwoDays
TwoDays = Format(WorksheetFunction.<wbr>WorkDay(Date, -2), "yyyy mm-dd")
Kill "C:\Test\ & TwoDays & TheRestOfFileName.xlsx"
End Sub