I would like to open a workbook in a new instance of Excel, then copy ranges from within several different sheets in another (already open) workbook to specified ranges in the newly opened workbook.
Here's what I have so far:
Dim wbl As Workbook
Set wbl = Workbooks("exports - 27thNov.xlsm")
Dim wsl As Worksheet
Set wsl = Sheets("odbd")
Dim lrl As Long
lrl = wsl.Range("A" & Rows.Count).End(xlUp).Row
Dim wbl2 As Workbook
Set wbl2 = Workbooks("pltemplate.xlsx")
Dim wsl2 As Worksheet
Set wsl2 = wbl2.Sheets("S")
wbl.Worksheets("odbd").Range("A2:AK" & lrl).Copy
wbl2.Activate
wsl2.Range("A4").Select
wsl2.Range("A4").PasteSpecial Paste:=xlPasteValues
Note: the Activate & Select commands were added to try to force the macro to work in some way.
Also, I changed the name of the destination workbook ("pltemplate.xlsx") to make it a more simple string, as well as the name of the source worksheet ("S"), yet I get the same run-time error message.
The line which throws out the error is:
Set wbl2 = Workbooks("pltemplate.xlsx")