Change VBA Path/Copy 1 file

  • I apologize in advance, I have very little excel-VB experience.

    I currently have two modules that: goes to the specified file path, tries to find the parent folder. Next, treat each file as an object, and iterate through all of the items and puts them into an array. The macro will then try to open each excel file **in the folder** and copy from the relevant range (or sheet) specified in the folder and paste it into a newly created spreadsheet. The code works, but I would like it to only accept ONE excel file from either a path put in a cell or a variable and not a folder. As it is, it will open an entire folder and copy all the excel files over to another sheet.

    Instead of modifying the file path in the macro and finding all the files in that folder, I would like to use a series of file paths (or just 1 if not possible) from cells in Column A. Is it possible to put each single file from the specified path into the array instead? The quick fix I can think of is to: change the rootFolder array to only accept the specified file. Could someone tell me how to go about doing that?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!