I have a folder with Excel files which have the name is formatted "file_" & Date &_" & i & ".xls", where i is an integer between 1 and 5.
Based on the date there may be any number between 1 and 5 files in the folder:
file_01.01.2019_1.xls
file_02.01.2019_1.xls
file_02.01.2019_2.xls
file_03.01.2019_1.xls
file_03.01.2019_2.xls
file_03.01.2019_3.xls
I want to provide a date, let's say January 2nd and in a for loop open all files from that date. However, I cannot give a fixed upper value for i.
If I knew the number of files per date it would look like this:
Dim Date As Date
Date = 02.01.2019
For j = 1 To i
Workbooks.Open "path" & "file_" & Date & "_" & j & ".xls"
Copy and Paste Operations to another Workbook here
Workbooks("file_" & Date & "_" & j & ".xls").Close SaveChenges:=False
Next