candrews84
New Member
- Joined
- Aug 30, 2015
- Messages
- 10
Any help is greatly appreciated. To simplify:
-I have multiple files for 2016 say files A, B, C, D, E, F (each file is labeled with the year at the end ex. A 2016.xls)
-I need to copy certain data (all on one worksheet) for the same files from 2015 (A 2015.xls, B 2015.xls, etc.) into the 2016 file
-2015 files are saved at another location ex. File Path/2015/A 2015.xls
-So for file A 2016.xls, I have a rudimentary macro written that will open file path where file A 2015.xls is saved, copy data ranges (ex. A1:C1, A5:C5, and A10:C10) and paste them into the A 2016.xls file, into ranges B1:D1, B5:D5, and B10:D10. The macro will then close file A 2015.xls, and save file A 2016.xls where it is.
-The issue I'm having is that I have about 250 files I need to do the above for. The macro I put together works but it is very rudimentary and requires I open each 2016 file, input the VBA code, update the file paths and names in the code, then run it. I would like to set this up where I have one code set with all the file paths and names so that ideally I run the code once and all 250 files will be updated.
-I believe the layout of such code would required all the files paths and names of the 2016 files as well as all the file paths and names of the 2015 files, the code would then just need to specify what ranges to copy from the 2015 files and where to paste them in the 2016 files.
I'm no VBA expert but if someone could assist with a basic template of what such could would look like I should be able to manipulate it on my own to make it work for my needs. My existing code is not efficient and I'm looking for the most efficient way to complete this task.
-I have multiple files for 2016 say files A, B, C, D, E, F (each file is labeled with the year at the end ex. A 2016.xls)
-I need to copy certain data (all on one worksheet) for the same files from 2015 (A 2015.xls, B 2015.xls, etc.) into the 2016 file
-2015 files are saved at another location ex. File Path/2015/A 2015.xls
-So for file A 2016.xls, I have a rudimentary macro written that will open file path where file A 2015.xls is saved, copy data ranges (ex. A1:C1, A5:C5, and A10:C10) and paste them into the A 2016.xls file, into ranges B1:D1, B5:D5, and B10:D10. The macro will then close file A 2015.xls, and save file A 2016.xls where it is.
-The issue I'm having is that I have about 250 files I need to do the above for. The macro I put together works but it is very rudimentary and requires I open each 2016 file, input the VBA code, update the file paths and names in the code, then run it. I would like to set this up where I have one code set with all the file paths and names so that ideally I run the code once and all 250 files will be updated.
-I believe the layout of such code would required all the files paths and names of the 2016 files as well as all the file paths and names of the 2015 files, the code would then just need to specify what ranges to copy from the 2015 files and where to paste them in the 2016 files.
I'm no VBA expert but if someone could assist with a basic template of what such could would look like I should be able to manipulate it on my own to make it work for my needs. My existing code is not efficient and I'm looking for the most efficient way to complete this task.
Last edited: