Arrays containing variable sheets

  • Thread starter Thread starter RichA
  • Start date Start date
R

RichA

I am looking to be able to copy a number of sheets to a new workbook. However, these are not always the same sheets.


Sub Macro1()
Sheets(Array("SheetA", "SheetB")).Select
Sheets(Array("SheetA", "SheetB")).Copy
End Sub


How do I either:
(a) set the array to be the selected sheets prior to the macro being run? [I tried selectedsheets.select but it errored?]

(b) Creat an inputbox that allows an array of sheets (they are not always next to each other)?

Many thanks,
Rich
 
I am looking to be able to copy a number of sheets to a new workbook. However, these are not always the same sheets.


Sub Macro1()
Sheets(Array("SheetA", "SheetB")).Select
Sheets(Array("SheetA", "SheetB")).Copy
End Sub


How do I either:
(a) set the array to be the selected sheets prior to the macro being run? [I tried selectedsheets.select but it errored?]

(b) Creat an inputbox that allows an array of sheets (they are not always next to each other)?

Many thanks,
Rich
Hi Rich,

Try:

ActiveWindow.SelectedSheets.Copy


===
Regards,
Norman
 
Back
Top