Consolidate Excel workbooks into a single workbook

They all live in the same folder and really just have one tab each.
They need to retain the tab names in the master workbook.
K BAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:
If all you have in the folder are Excel files, you can use this which will copy all worksheets from each of the workbooks.

Sub ConsolidateWorkbooks()

    Application.ScreenUpdating = False

    Dim FileName As String, wb As Workbook, ws As Worksheet
    FileName = Dir(ThisWorkbook.Path & "\")
    Do While FileName <> ""
        If FileName <> ThisWorkbook.Name Then
            Set wb = Workbooks.Open(FileName)
            For Each ws In wb.Worksheets
                ws.Copy After:=ThisWorkbook.Worksheets(1)
            wb.Close False
        End If
        FileName = Dir
    Application.ScreenUpdating = True
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne Taylor (webtubbs)Commented:
The above routine should be run from the Master workbook, which should be saved in the same location as the workbooks to consolidate.
K BAuthor Commented:
Thank you very much!! I have one more out there fairly similar

also you helped me on
and it errored out.   So close to createds CSVs but hit a error.

Wayne as always thank you for your knowledge!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.