Data consolidation

Flowerstloft

New Member
Joined
Oct 26, 2011
Messages
17
<TABLE id=post2925950 class=tborder border=0 cellSpacing=0 cellPadding=6 width="100%" align=center><TBODY><TR vAlign=top><TD style="BORDER-BOTTOM: #ffffff 0px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-TOP: #ffffff 0px solid; BORDER-RIGHT: #ffffff 1px solid" class=alt2 width=175></TD><TD style="BORDER-RIGHT: #ffffff 1px solid" id=td_post_2925950 class=alt1><!-- icon and title -->
</TD></TR></TBODY></TABLE>I am trying to consolidate a range of data from many excel files in a folder/directory into one excel file called Master Data file without opening all of the source files.

All files have the exactly same structures (the same column names...) and the data (in the souce files) is in the sheet 1 (there are Sheet 2 and 3 that are blank)

The row range of data (or number of records) in each file differ from each other

Any help would be greatly appreciated!! <!-- / message -->
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try something like this.


Loop through all workbooks and a sheet merge data
Sub Open_My_Files()
Dim mypath As String
Dim MyFile As String
mypath = "M:\Access Files\"
MyFile = Dir(mypath)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Sheets("sheet1").Range("A1") = "Headings"
Do While MyFile <> ""
If MyFile Like "*.xls" Then
Workbooks.Open mypath & MyFile
Sheets(1).UsedRange.Copy
ActiveWorkbook.Close True
Range("A1").Select
Range("A" & Rows.Count).End(xlUp).Select
ActiveCell.Offset(1, 0).PasteSpecial xlPasteAll
Cells.PasteSpecial xlPasteAll
End If
MyFile = Dir
Loop
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Hey Trevor G:

It's not pulling the data in.....i changed my path to where the source files are....

Also, I don't think I was clear on my requested....but I would like the data to be consolidated into one sheet in the master fil.

Thank you!!
 
Upvote 0
What is the code doing then, this has worked for me for a long time now.

Did you open the Master workbook first and is it located in a different folder?
 
Upvote 0
The master file is in a different dir. Let me move it to the same folder. Also, would the code consolidate the data in one single sheet in the master file?

Thank you
 
Upvote 0
Keep the Master workbook in a different folder add the code into the Master workbook.

Do some dummy testing before you run this on the live version.

Yes it would consolidate it into sheets("Sheets1") which you can change and also you could ignore the Heading part replace this with your sheet name and .select

so
Sheets("SheetName").Select
Sheets("sheet1").Range("A1") = "Headings"
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,101
Members
448,548
Latest member
harryls

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