top copy multiple sheets to new book

tourless

Board Regular
Joined
Feb 8, 2007
Messages
144
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,

Like the title says, I'm trying to take three sheets from the active workbook and copy them to a new workbook, however I don't think it's as easy as
Code:
ThisWorkbook.Sheets(wsRequired1, wsRequired2, wsRequired3).Copy
. Apparently that's too many arguments. I was hoping it could be done without first having to create the new workbook separately but I'm not sure if that's possible. What are my options here?

thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try
Code:
ThisWorkbook.Sheets(Array(wsRequired1, wsRequired2, wsRequired3)).Copy
 
Upvote 0
odd that it doesn't work with worksheet code names but non-the-less...
Code:
ThisWorkbook.Sheets(Array("Required1", "Required2", "Required3")).Copy
works perfectly.

Thanks!
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback.

It doesn't work with the code name, because Sheets(...) requires a sheet name.
But you can do it like
Code:
Sheets(Array(Sheet9.name, Sheet8.name)).Copy
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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