VBA loop to open workbooks, copy and paste data

meganduerk

New Member
Joined
Aug 4, 2016
Messages
1
Hi,

I'm hoping I can get some helping with adding VBA code to my workbook that will merge data from multiple "detail" workbooks to one consolidation workbook. I have a list of file paths, names and sheet names in my consolidation workbook. I would like the macro to follow the first "detail" file path & open the first file that I have listed in the consolidation file, go to the specified sheet, find the column which contains x and the row the contains y (x and y are the same in all files) and copy everything to the left and above of x and y, and then paste in the specified sheet in the consolidation file, close the "detail" file and then repeat for the second file in the list and so forth. And then hide each of the consolidated sheet names in the consolidation workbook.

[TABLE="width: 500"]
<tbody>[TR]
[TD]File Name[/TD]
[TD]Detail Sheet Name[/TD]
[TD]Consolidated Sheet Name[/TD]
[TD]File Path[/TD]
[/TR]
[TR]
[TD]Department 99[/TD]
[TD]2016CY Actl[/TD]
[TD]99 - General[/TD]
[TD]'\\data\corp\actl\[Department 99]2016CY Actl'![/TD]
[/TR]
[TR]
[TD]Department 76[/TD]
[TD]2016 CY Actual[/TD]
[TD]76 - Mkt[/TD]
[TD]'\\data\corp\actl\Mkt\[Department 76]2016CY Actual'![/TD]
[/TR]
[TR]
[TD]etc.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]



Thank you in advance for your help!

Megan
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top