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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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