Macro to copy data from multiple files into specific tabs in consolidated file

Pyes

New Member
Joined
May 21, 2021
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

There's a piece of work I have to do on a monthly basis which can get quite repetitive. I have to copy the data from individual files and paste them in to different tabs in a master template. For example, we I have files called "Dept 0, Dept 1, Dept 2" etc and then the data from these files then have to go into the tab named "0, 1, 2" etc.

Is there a way that a macro can go through and copy the data from file Dept 0 and paste it into 0 and then go through each file in the specified folder and paste it into the tab? No formatting is needed on the data, it just needs to paste it into cell A1 in each tab.

I have been able to get a macro to copy data from multiple files all saved in one specific folder into one tab on the consolidated file, but I'm struggling to get the data to paste into the different tabs. All of the files will be saved in the same file so just selecting the folder to import will work well.

Any help is much appreciated.

Thanks,
Tom
 
It's got a couple of steps further, but has tripped up at the below point:

1621952425414.png


It had opened up the first file "Dept 0" in the folder.
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
What error message do you get when you click "Debug"?
 
Upvote 0

Hi, as there is no check if only the 'tabname' worksheet exists at least …​
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

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