VBA copying multiple sheets to multiple sheets

Jumparound

New Member
Joined
Aug 4, 2015
Messages
45
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have been wrestling with this for a while trying a number of bits of code I have found online but can't find anything that matches what I want to do or can change enough to make it work for me.

I have workbooks of data in a folder and I want to copy a range of data from each one into different worksheets of a master sheet in the same folder. The files to copy from are labelled as follows:
TS Weekly Report - SiteA Jan
TS Weekly Report - SiteB Jan
TS Weekly Report - SiteC Jan
TS Weekly Report - SiteD Jan
TS Weekly Report - SiteE Jan

The file to copy to is:
TS Weekly Report - UK Jan

All these workbooks are in C:\Users\User\Desktop\Test

All the files to be copied from have a worksheet called Site Summary and the data to be copied in all these is in C9:D27
I would like to paste these data into the same place in a worksheet for each site in the UK Jan workbook. So it would open SiteA workbook copy the data from C9:D27 in Site Summary and paste into the UK Jan workbook in worksheet SiteA in cells C9:D27. Then open SiteB workbook copy the data from C9:D27 in Site Summary and paste into the UK Jan workbook in worksheet SiteB in cells C9:D27 and so on.....

Can anyone help with this?
 
I'm glad it worked out. :) @Fluff: Thank you for your suggestion. Would you have any idea why the original code I posted worked for me but generated an error for the PO?
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Dir will look in the active directory, unless told otherwise.
So initially that will be your default xl path, but if you save a file to another location (such as C:\Users\User\Desktop\Test\) that will then be the active directory.
I suspect that you had saved a file to the test directory, hence that is where Dir looked, but the OP may still have had the default path as active, hence it Dir was looking in the wrong place.

HTH
 
Upvote 0
That makes perfect sense. Thank you once again. By the way, congratulations on being appointed as Moderator. :beerchug:
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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