macro Copying worksheets from multiple open workbooks into current workbook.

RAM1972

Board Regular
Joined
Jun 29, 2014
Messages
217
I have 4 to 6 workbooks opened in which there are sheets , the sheet names have no duplicates names across the workbook opened .

I looking a macro that copy all sheets in the opened workbook to current book .

The current workbook has only one sheet named master1.

I got some similarities but tested bit not worked

Code:
https://excel.tips.net/T007425_Combining_Worksheets_from_Many_Workbooks.html
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What is the name of the workbook containing the "Master1" worksheet?
 
Upvote 0
Do you want to copy all the sheets from the source workbooks to the "Master1" sheet so they are all on one sheet or do you want to copy the sheets as separate sheets to the Master Control workbook?
 
Upvote 0
To copy as separate sheets to the master control workbook because the ranges headers varies per sheet
 
Upvote 0
Place this macro in a regular module in the current workbook and run it from there.
Code:
Sub CopySheets()
    Application.ScreenUpdating = False
    Dim WB As Workbook
    Dim ws As Worksheet
    Dim desWB As Workbook
    Set desWB = ThisWorkbook
    For Each WB In Workbooks
        If WB.Name <> desWB.Name Then
            For Each ws In WB.Sheets
                ws.Copy desWB.Sheets(desWB.Sheets.Count)
            Next ws
        End If
    Next WB
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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