Looping through sheets to select range, copy and paste

rafikarp

New Member
Joined
Dec 23, 2008
Messages
21
Hi,

I am trying to write a macro that will loop through all sheets in my workbook except one (entitled "List"), and copy the same range in each sheet (B1:B6) and then paste into the sheet "List" one under the other using the NextRow method.

I have browsed some previous posts on the same topic and tried to adapt them to my needs but I am so far unsuccessful. The loop is not working. This is what I have so far. Any help would be much appreciated. Thanks!

Dim wst As Worksheet

Sheets(1).Select

For Each wst In Worksheets

Select Case wst.Name
Case "List" 'Do Nothing
Case Else

Range("B1:B6").Select
Selection.Copy
Sheets("List").Select
Range("I2:I7").Select
ActiveSheet.Paste

NextRow = Sheets("List").Range("A" & Rows.Count).End(xlUp).Row + 1

Cells(NextRow, 1) = Sheets("List").Range("I2")
Cells(NextRow, 2) = Sheets("List").Range("I3")
Cells(NextRow, 3) = Sheets("List").Range("I4")
Cells(NextRow, 4) = Sheets("List").Range("I5")
Cells(NextRow, 5) = Sheets("List").Range("I6")
Cells(NextRow, 6) = Sheets("List").Range("I7")

Range("I2:I7").ClearContents

End Select
Next wst

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try

Code:
Sub Cpy()
Dim ws As Worksheet, NR As Long
NR = 2
For Each ws In ThisWorkbook.Worksheets
    If ws.Name <> "List" Then
        ws.Range("B1:B6").Copy Destination:=Sheets("List").Range("I" & NR)
        NR = NR + 6
    End If
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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