copy sheets to one sheet

Computerised10

New Member
Joined
Oct 2, 2014
Messages
20
hi

i could have up to 50 sheets all contain data. i need to copy all those sheets and data to to sheet1.

any help will be appreciated.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
Sub copyAllSheetsToMasterSheet()
    masterSheet = "Master"  'The sheet name of your master sheet
    firstRow = 2  'first row of data begins in row 2 if you have headers on each sheet
    For Each wkst in Worksheets
        If wkst.name <> masterSheet Then
            lastRow = Sheets(wkst.name).Range("A" & Rows.Count).End(xlUp).Row
            lastColumn = Sheets(wkst.name).Cells(firstRow, Columns.Count).End(xlToLeft).Column
            Sheets(wkst.name).Range(Cells(firstRow, 1), Cells(lastRow, lastColumn)).Copy
            nextRow = Sheets(masterSheet).Range("A" & Rows.Count).End(xlUp).Row + 1
            [COLOR=#000080]ActiveSheet.Paste Destination:= Sheets(masterSheet).Range("A" & nextRow)[/COLOR]
            CutCopyMode = FALSE
        End If
    Next wkst
End Sub
OR
Code:
Sub copyAllSheetsToMasterSheet()
    masterSheet = "Master"  'The sheet name of your master sheet
    firstRow = 2  'first row of data begins in row 2 if you have headers on each sheet
    For Each wkst in Worksheets
        If wkst.name <> masterSheet Then
            lastRow = Sheets(wkst.name).Range("A" & Rows.Count).End(xlUp).Row
            lastColumn = Sheets(wkst.name).Cells(firstRow, Columns.Count).End(xlToLeft).Column
            Sheets(wkst.name).Range(Cells(firstRow, 1), Cells(lastRow, lastColumn)).Copy
            nextRow = Sheets(masterSheet).Range("A" & Rows.Count).End(xlUp).Row + 1
            [COLOR=#000080]Sheets(masterSheet).Range("A" & nextRow).PasteSpecial xlPasteValues[/COLOR]
            CutCopyMode = FALSE
        End If
    Next wkst
End Sub
 
Last edited:
Upvote 0
MAybe this
Code:
Sub ConsolidateSheets()
Dim ws As Worksheet
Dim LR As Long, NR As Long
Application.ScreenUpdating = False
NR = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
For Each ws In Worksheets
    If ws.Name <> "Sheet1" Then
        LR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
            ws.Rows("1:" & LR).Copy Destination:=Sheets("Sheet1").Range("A" & NR + 1)
            NR = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
        End If
Next ws
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,946
Members
449,275
Latest member
jacob_mcbride

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