Iterating through worksheets on 2 workbooks, copying and pasting

BTLbl

New Member
Joined
Dec 3, 2018
Messages
5
Hi,

I am trying to iterate through multiple worksheets and copy and paste the data through multiple (equivalently named) worksheets in a separate workbook.

Essentially:
Workbook 1 - Sheet 1 - copy range
Workbook 2 - Sheet 1 - paste range in next empty row
Workbook 1 - Sheet 2 - copy range
Workbook 2 - Sheet 3 - paste range in next empty row

etc. for about 50 sheets.

I have VBA that will copy one range of cells on a single worksheet and paste to iterative sheets on a second workbook, but need to also iterate through the first sheet.

e.g. for a single worksheet in workbook 1

Code:
Sub singlecopy()
Dim sht As Worksheet


Sheets("Sheet1").Range("a2:c2").Copy


With Workbooks("summarysheet.xlsx")


For i = 1 To .Sheets.Count


   .Sheets(i).Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues, Transpose:=True


Next i


End With
End Sub

How do I apply a for loop for the 50 sheets in workbook 1 as well?

thanks
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

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