Hi Forum experts, first post!
Trying to get 3 specified sheets from one work book copied over to another workbook.
Set up an array and loop and it runs through the first loop but gets stuck with a subscript out of range error at the Set in the second loop.
Any idea what I'm doing wrong?![]()
Dim array1(2) As String array1(0) = "source1" array1(1) = "source2" array1(2) = "source3" Dim mtabname As Worksheet Dim i As Variant For Each i In array1 Set mtabname = Worksheets(i) Sheets(i).Select Sheets(i).Copy after:=Workbooks("target.xlsm").Sheets(Workbooks("target.xlsm").Worksheets.Count) Sheets(Sheets.Count).Name = i Next
Bookmarks