update data on different worksheets in Masterworkbook. Data to be updated is in different workbooks in same folder

RaceExcel

New Member
Joined
May 4, 2004
Messages
25
Hi,

I have 32 different worksheets in a master workbook. The 32 different sheets are holding similar data about 32 seperate entities. Each of these 32 entities provides me with a workbook which has multiple worksheets. Sheet 2 of each of these entity workbooks has the data I need copied from the entity workbook to my masterworkbook. The data from entity x workbook should go to the entity x worksheet in the Master workbook.

I am using the following code but am having some problems;
I intend to
activate the Masterworkbook (ThisWorkbook) first.
Go to entity 1 worksheet, use the name of the worksheet to concactenate the path for the entity 1 workbook,
check if the entity 1 workbook is there in the folder,
if the entity 1 workbook is there copy data in Range (A6, t14)from Sheet 2 of entity 1 workbook and then paste the same data in entity 1 worksheet in the master workbook
otherwise Msg box message = "Not Found"
go to next entity worksheet in the master workbook and repeat

Sub link_files()

Dim WIPSWS As ThisWorkbook
Dim DepStaff As Worksheets
Dim WIPDEPT As Workbook
Dim WBPath As String

WBPath = "B:\2014 Budget\WIP 2013"
For Each DepStaff In WIPSWS
Set WIPDEPT = Workbooks.Open(WBPath & "\" & DepStaff.Name & ".xlms")
Active Workbook.Sheet2.Activate
Range(A6, T9).Copy
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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