Consolidate Multiple workbook to one worksheet

p9j123

Active Member
Joined
Apr 15, 2014
Messages
288
Office Version
  1. 2013
Platform
  1. Windows
I need help on building a macro that will consolidate multiple workbook to one worksheet.

There are 2 sheets on File "Masterfile.xlxs."

DB - Database of the consolidated file.
Directory - List of the Workbook that needs to be consolidated, path and extension included.

There are multiple sheets on the file that needs to be consolidated, but only the QUEUE2 Sheets is needed from L5 to the last row with content.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
For those looking for the same macro....

Code:
Sub Consolidate()
'Consloidate Tracker to get the status
Dim AWB As Workbook
  


Set AWB = Application.ActiveWorkbook
 
pathcount = Worksheets("List").Cells(Rows.Count, 15).End(xlUp).Offset(1, 0).Row - 1


For x = 7 To pathcount 'my directory list starts on O7
 
  
  wname = AWB.Worksheets("Directory").Range("O" & x).Value


Application.DisplayAlerts = False
  Set swb = Workbooks.Open(wname, ReadOnly:=True, Notify:=False, UpdateLinks:=False)
  araw = swb.Worksheets("Queue2").Cells(Rows.Count, 12).End(xlUp).Offset(1, 0).Row ' identify the last row on source file in L column
  traw = AWB.Worksheets("DB").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row 'to identify the last row on the mainfile


'  [Code to copy the content of Individual Tracker to your Main File]
  swb.Worksheets("Queue2").Range("L5:P" & araw).Copy               'source
  AWB.Worksheets("DB").Range("A" & traw).PasteSpecial xlPasteValues          'Main File


 swb.Close
 Application.DisplayAlerts = True


Next x


Sheets("DB").Select


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
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