Morning
Little conundrum for some lovely helpful person to help me work out. Thanks in advance by the way.
I'm currently using the below macro portion to open a .txt file for a previous day's date and delimit text it to columns in Excel, the Xs are in place of the file name, and the date is in the file name too
As you can see from the code, this is to open a file that is dated for the immediate day before the day the macro is run.
However, I am coming up with a problem that requires us to constantly change the file name of the file we are running.
For instance, if we run the macro on a monday, the macro obviously looks for a file dated for the Sunday, when realistically, it should be looking for a file dated for friday. And the same for if it's a bank holiday monday. We run on the tuesday, but the macro looks for a file dated monday, when it would naturally still be the friday one, and it gets even more confusing when you factor in running the file on the first of the month, the macro looks for a file dated 0.
What I want to know, is if it's possible to get the macro to look for the next/previous actual available date/month/year, rather than the way I currently have it, and if so, how would I go about it?
Thanks again in advance for any help regarding this.
Bookmarks