I need to copy some worksheets from a workbook. I found this code to help me copy multiple worksheets from one workbook to another:-
as I couldn't get a loop to work. (Basically I couldn't get the focus back to the original workbook after it had completed the 1st pass & copied (from an array "MySheets") the 1st worksheet to the current workbook using this code)
I tried things along the lines of:-
So what I'd like to do now is (somehow) use the array of sheet names that I already have, to determine the
array as I want it to be more flexible than:-
Can it be done? Or what would be the best way to achieve this?
Many thanks,
Des
Code:
With Workbooks("Workbook1.xls")
.Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy _
Before:=Workbooks("Workbook3.xls").Sheets(1)
End With
Code:
For CA = 1 To x - 1 'Copy all the named worksheets from source file to present file
Sheets(MySheets(CA)).Copy After:=Workbooks("LBL spec w3wk5 Test_Version.xlsx").Sheets(WSS + CA - 1) 'WSS = Worksheets.Count
Next CA
I tried things along the lines of:-
Code:
Windows(sourcefile).Select
So what I'd like to do now is (somehow) use the array of sheet names that I already have, to determine the
Code:
.Copy
Code:
.Sheets(Array("q1a", "q3_1_corporate_other", "q3_2_other_spec")).Copy
Can it be done? Or what would be the best way to achieve this?
Many thanks,
Des