JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I'm trying to copy an array of sheets into a new workbook but getting run-time error (method copy of object sheets failed) with following:
Can anyone suggest correct syntax or alternative code to achieve same? I want to keep sheet names isolated and in a separate function
TIA,
Jack
I'm trying to copy an array of sheets into a new workbook but getting run-time error (method copy of object sheets failed) with following:
Code:
Sub Main()
Sheets(Array(Split(MySheets, "|"))).Copy
End Sub
Private Function MySheets() as String
MySheets = "Sheet1|Sheet2|Sheet3"
End Function
TIA,
Jack