copy and past multiple sheets

jtodd

Board Regular
Joined
Aug 4, 2014
Messages
194
HI
I have a workbook with several sheets with same layout but different data,
How can I copy data from all sheets into 1, the amout of data varies so would need to past all data into next empty row.
I have this code

Sub SummurizeSheets()
Dim ws As Worksheet

Application.ScreenUpdating = False
Sheets("Summary1").Activate

For Each ws In Worksheets
If ws.Name <> "Summary1" Then
ws.Range("A:L").Copy
Worksheets("Summary1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
End If
Next ws
End Sub

I just get debug , !!!!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try this:
Code:
Sub SummurizeSheets()
'Modified  7/13/2018  5:48:54 AM  EDT
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim Lastrow As Long
Dim i As Long
Sheets("Summary1").Activate
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Summary1" Then
            Lastrow = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
            Sheets(i).Cells(1, 1).Resize(Lastrow, 12).Copy
            Worksheets("Summary1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks that works ,
Next , there are two sheets that i do not want included , is there a simple way of excluding them ?:rolleyes:
 
Upvote 0
Try this look at the code and change You and Me to the proper sheet names you want excluded.
Code:
Sub SummurizeSheets()
'Modified  7/13/2018  6:17:33 AM  EDT
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim Lastrow As Long
Dim i As Long
Sheets("Summary1").Activate
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Summary1" And Sheets(i).Name <> "Me" And Sheets(i).Name <> "You" Then
            Lastrow = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
            Sheets(i).Cells(1, 1).Resize(Lastrow, 12).Copy
            Worksheets("Summary1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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