Copying Several Worksheets from One book to Another

huar

New Member
Joined
Nov 4, 2010
Messages
13
I have to copy several worksheets from one workbook A to another workbook B. The worksheets I have to copy go from the 13th sheet in workbook A to the last sheet, and have to be copied over to workbook B. Each copied sheet goes at the end of workbook B. Currently, workbook B has 7 sheets.

I have tried the following code, but I keep on getting a 'workbook' error. Can someone please, please assist? Thank you.


Windows("A.xls").Activate

For counter = 13 To ActiveWorkbook.Sheets.Count

Sheets(counter).Copy After:=Workbooks("B.xls").Sheets(Workbooks("B.xls").Sheets.Count)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
So somehow I've managed to copy one worksheet over, but now my for loop isn't working...as the macro breaks after copying just one sheet over

For counter = 13 To ActiveWorkbook.Sheets.Count

ActiveWorkbook.Sheets(counter).Copy After:=Workbooks("B.xls").Sheets(Workbooks("B.xls").Sheets.Count)

Next counter

Can anyone please help?
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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