Joe4
MrExcel MVP, Junior Admin
- Joined
- Aug 1, 2002
- Messages
- 74,623
- Office Version
- 365
- Platform
- Windows
I would like to create a macro that does the following that will combine an undetermined amount of data files into one file. I envision it work something like this:
1. Allows the user to browse a directory and select/open as many files in the directory as they wish (using CTRL to select multiple files). They could select any number of files.
2. Loop through all the files, copy and paste their data to one file, and close all the files (other than new "combined file"). The trick here is that I only want to loop through the files that were just opened. If the user had any Excel files open on their computer prior to running this macro, I want to ignore those files.
I know how to browse and open ONE file, and I know how to copy and paste the data via VBA, I just need to find out how to open multiple files, and loop through those files just opened. Can anyone help?
Thanks.
1. Allows the user to browse a directory and select/open as many files in the directory as they wish (using CTRL to select multiple files). They could select any number of files.
2. Loop through all the files, copy and paste their data to one file, and close all the files (other than new "combined file"). The trick here is that I only want to loop through the files that were just opened. If the user had any Excel files open on their computer prior to running this macro, I want to ignore those files.
I know how to browse and open ONE file, and I know how to copy and paste the data via VBA, I just need to find out how to open multiple files, and loop through those files just opened. Can anyone help?
Thanks.