I'm trying to copy all of the sheets in an array to a new workbook called ArrayBook.xls
I keep getting an error at this point in the code.
ThisWorkbook.Sheets(myArray).Copy After:=Workbooks("ArrayBook.xls").Sheets(1)
Here is the rest of the code
myArray = Application.Transpose(Worksheets("MonthlyTotals").Range("HX1:HX7"))
Application.DisplayAlerts = False
ThisWorkbook.Sheets(myArray).Copy Before:=Workbooks("ArrayBook").Sheets(1)
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & ArrayBook & ".xls"
I also tried this approach and got an error " Subscript out of range "
For Each sh In myArray
sh.Copy After:=Workbooks("ArrayBook.xls").Worksheets(1)
Next sh