Extract multiple rows from different worksheets?

mel20

New Member
Joined
Mar 27, 2006
Messages
11
Hi,

I was wondering if anyone can help with what is probably quite a simple question for more computer literate people than me....

I have a workbook with multiple (100+) worksheets in. Each of these worksheets is in exactly the same format but each worksheet is data from a different person. Each row shows a different parameter and each coloumn shows each minute throughout the test.

What i would like to do is extract row 1 from each worksheet and compile this is a summary sheet. I would then also like to do this for rows 2, 4,5,6 and 8 so I end up with 6 seperate summary sheets. I would also like the worksheet name is be in coloumn A in the summary sheet so I can identify whose data is whose.

I attempted to modify other macros that I found but alas it was to no avail. If anyone has the time to help I would be very grateful.

Thank you
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Code:
Sub Summary_Sheets()
    
    Dim r As Variant, i As Long, Nextrow As Long, ws As Worksheet
    
    r = Array(1, 2, 4, 5, 6, 8)    'rows to summarize
    
    Application.ScreenUpdating = False
    
    Worksheets.Add Before:=Sheets(1), Count:=UBound(r) + 1  'Create new summary worksheets
    For i = 0 To UBound(r)
        Sheets(i + 1).Name = "Summary Row" & r(i)           'Name each new summary sheet
    Next i
    
    For Each ws In Worksheets
        If Left(ws.Name, 7) <> "Summary" Then
            Nextrow = Nextrow + 1
            For i = LBound(r) To UBound(r)
                With Sheets("Summary Row" & r(i))
                    .Range("A" & Nextrow).Value = ws.Name
                    .Range("B" & Nextrow).Resize(, Columns.Count - 1).Value = ws.Rows(r(i)).Value
                End With
            Next i
        End If
    Next ws
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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