Hello,
I'm using Excel 2013.
I've got many workbooks in a folder. I want to open all these workbooks one by one, run a macro, save the workbook & close it. I do not want to specify the names of the workbooks in the folder so that I can simply add / remove workbooks in the future without having to edit the macro. Therefore, the macro needs to detect all .xlsx in the folder automatically.
The macro will be stored in another workbook stored elsewhere in my pc. I visualize the macro to look something like this:
How do I do this?
Thanks a lot for your help.
I'm using Excel 2013.
I've got many workbooks in a folder. I want to open all these workbooks one by one, run a macro, save the workbook & close it. I do not want to specify the names of the workbooks in the folder so that I can simply add / remove workbooks in the future without having to edit the macro. Therefore, the macro needs to detect all .xlsx in the folder automatically.
The macro will be stored in another workbook stored elsewhere in my pc. I visualize the macro to look something like this:
Code:
Sub test()
open the workbook in the specified folder
do some stuff
ActiveWorkbook.Save
ActiveWorkbook.Close
loop the macro until all workbooks have been processed
End Sub
Thanks a lot for your help.