vba to copy data from multiple workbooks

edm123

New Member
Joined
Sep 19, 2016
Messages
1
All,

I am trying to write a macro within a central model (let's call this the 'aggregator model') to open a series of spreadsheets (one at a time), then copy data and paste as hardcoded values into the central model.

The main difficulty I can see, is identifying the area where the data should be pasted in the aggregator model, as it must be on a separate/specific worksheet for each underlying spreadsheet.

To get set up, I have:
- saved all the underlying spreadsheets into a single folder
- set the copy area and paste areas as the exact same size
- applied a named range ("CopyArea") to the area to be copied from each underlying spreadsheet
- applied a named range ("PasteArea") to the area to be pasted to on each worksheet within the aggregator model (note: these named ranges are attached to the worksheets, not the workbook)

On a separate control worksheet in the aggregator model, I have also created a list of all the external underlying models (saved in column A) and matched the desired worksheet that it should be pasted to (column B). So this provides a list of all the external workbooks to be used, and shows which worksheet in the aggregator model that they relate to.

I have to import data from c.100 spreadsheets, and I am sure there must be a much more efficient way of doing this that manually opening each then copying and pasting!

In case it makes a difference, I use Excel 2016.

Really appreciate your help!

Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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