ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro On Multiple Closed Workbooks (https://www.excelbanter.com/excel-programming/347052-run-macro-multiple-closed-workbooks.html)

Andy

Run Macro On Multiple Closed Workbooks
 
I have a file named Master.xls with a list of numbers in col A that refer to
the names of thousands of text (nnnnnnn.log) files in the same folder as
Master.xls.
I have a macro to extract the data that I need from the log file (when I
open the log file in Excel), format and tabulate the data ready to export to
a databse, but, but I do not relish the thought of having to repeat the
process of open file, run macro, close file thousands of times.
Can anyone suggest how i could run this macro for each nnnnnn.log file
listed in col A of Master.xls ?
I'm sure the answer is pretty simple but then so am I!

Walt[_3_]

Run Macro On Multiple Closed Workbooks
 
Hi Andy,

There's a good example of the DIR Function in the VBA help system.
Within the loop described, you can test against your listing and open &
process where appropriate. I think it will get you there.

Best Regards,
Walt Weber



All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com