Excel Visual Basic - need help to create a loop of filenames
New VBA user here! :o)
I have created a sub which calls individual Excel worksheets and copy
certain rows into a new worksheet. Pretty basic.
All of the .xls file I am calling are sequential..ie project (1),
project (2), project (3), and so on.
Instead of listing each workbook individually, can I create some kind
of loop which will call up each workbook; like project (#+1).xls?
Here is the basics of the sub I am using:
Workbooks.Open Filename:=filepath & "project (1).xls"
Call copy_rows_into_new
Windows("project (1).xls").Activate
ActiveWorkbook.Close
Workbooks.Open Filename:=filepath & "project (2).xls"
Call copy_rows_into_new
Windows("project (2).xls").Activate
ActiveWorkbook.Close
etc. etc. etc.
Thanks for any assitance!!
|