![]() |
Inserting a worksheet into an open workbook via VBA code
I am trying to insert a worksheet from file into an open workbook with VBA
code. I was wandering what the code needs to look like. Thanks |
Inserting a worksheet into an open workbook via VBA code
"manillla" wrote in message
... I am trying to insert a worksheet from file into an open workbook with VBA code. I was wandering what the code needs to look like. Thanks Hi Manilla Try something like: Sub Tester() Workbooks("Book1.xls").Sheets("YourSheetName").Cop y _ After:=Workbooks("Book2.xls"). _ Sheets(Workbooks("Book2").Sheets.Count) End Sub --- Regards, Norman |
Inserting a worksheet into an open workbook via VBA code
Hi Manilla,
Sub Tester() Workbooks("Book1.xls").Sheets("YourSheetName").Cop y _ After:=Workbooks("Book2.xls"). _ Sheets(Workbooks("Book2").Sheets.Count) End Sub should have read: Sub Tester() Workbooks("Book1.xls").Sheets("YourSheetName").Cop y _ After:=Workbooks("Book2.xls"). _ Sheets(Workbooks("Book2.xls").Sheets.Count) End Sub (The ".xls" was missing from the last instance of "Book2"). --- Regards, Norman "Norman Jones" wrote in message ... "manillla" wrote in message ... I am trying to insert a worksheet from file into an open workbook with VBA code. I was wandering what the code needs to look like. Thanks Hi Manilla Try something like: Sub Tester() Workbooks("Book1.xls").Sheets("YourSheetName").Cop y _ After:=Workbooks("Book2.xls"). _ Sheets(Workbooks("Book2").Sheets.Count) End Sub --- Regards, Norman |
All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com