I'm trying to use VBA (Excel 2013 & Excel 2010) to open an existing worksheet with a file name that contains a date - specifically, the date of the last business day. But I'm having trouble identifying the most efficient way to use VBA to account for weekends and holidays. I've found the WORKDAY function does not work "directly" in VBA, but I've been successful in defining cell formulas in Excel via VBA.
The following code works when opening and saving files, but does not account for weekends and holidays:
This code successfully creates a new sheet called "Dates", but does not allow me to open a workbook with a date in the file name.:
The error I receive reads, "Sorry, we couldn't find 'Q:\Transfer\June\VBA\2014-01-06_Outages.xlsx". Is it possible it was moved, renamed or deleted?" I've confirmed the file does exist, and the original code listed above has no trouble opening the file.
Is there a tag/command/flag somewhere that I'm missing?
Thank you!
Bookmarks