geospatial
Active Member
- Joined
- Sep 2, 2008
- Messages
- 290
I currently have the following VBA code
This works fine except I now would like it to loop. If it finds jan2011.xls open it and then if it find feb2011.xls it also opens it and continues doing this until it doesnt find the specified file.
Code:
Dim directory as string
directory = "C:\New Folder\Working Folder\"
If Dir(directory & "Jan2011.xls") <> = "" Then
workbooks.Open fileName:=
"C:\New Folder\Existing\jan2011.xls"
Else
If Dir(directory & "Feb.xls") <> = "" Then
workbooks.Open fileName:=
"C:\New Folder\Existing\feb2011.xls"
This works fine except I now would like it to loop. If it finds jan2011.xls open it and then if it find feb2011.xls it also opens it and continues doing this until it doesnt find the specified file.