I am at a loss.
I have a piece of code that loops through files in a given folder, and does stuff.
However, before any of that I would like to Loop through the same folder and check that the DateLastModified date (Month only) is the same as the current month.
If a file is not (ie it is older) then I do not want any of the other loop to work (for any of the files), that is there will be no changes. All files need to have a datelastmodified of current month. (An all or nothing idea).
My Current Code is:
- MyPath = Sheets("Validate").Range("H1") 'Path where file can be found
- MyExt = "*.xlsx"
- MyFile = Dir(MyPath & MyExt)
- Filename = Sheets("Validate").Range("H2")
- SvPath = Sheets("Validate").Range("H4")
- Set MyName = Sheets("Selection").Range("D1") 'Name of .xls file to open
- Set BU = Sheets("Selection").Range("E1")
- Do While MyFile <> ""
- Set wb = Workbooks.Open(Filename:=MyPath & MyFile)
- 'do stuff...