copy a range from multiple worksheets to one worksheet

fedds2

New Member
Joined
Dec 30, 2005
Messages
32
I have a macro which inputs QC data as a text file then creates separate worksheets for each QC. It then calculates mean, SD and CV for the different analytes. The number of analytes can vary. This coding although crude works well.
I now want to create a summary sheet in order to print out the data. Each sheet has a Range J1:M12 with my required data.
How do I copy this range allowing for spacing etc onto one worksheet?

kind regards,
Peter
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try this on a copy of your workbook

Code:
Sub Generate_List()
Dim ws As Worksheet, cell As Range
Application.ScreenUpdating = False
If SheetExists("List") Then
    Sheets("List").Select
    Cells.ClearContents
Else
    Sheets.Add After:=Sheets(Sheets.Count)
    ActiveSheet.Name = "List"
End If
For Each ws In ActiveWorkbook.Worksheets
    If ws.Name <> "List" Then
        ws.Select
        Range J1:M12.Copy Destination:=Sheets("List").Cells(Rows.Count, "A").End(xlUp)
            End If
       Next ws
Sheets("List").Select
Application.ScreenUpdating = True
End Sub
 
Private Function SheetExists(SheetName As String) As Boolean
Dim x As Worksheet
On Error Resume Next
Set x = ActiveWorkbook.Sheets(SheetName)
SheetExists = (Err = 0)
Set x = Nothing
End Function
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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