Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need VB code for workbook open to open a link Daniel Baker Excel Discussion (Misc queries) 2 August 18th 06 01:30 AM
INserting a worksheet from one workbook to another workbook Billy New Users to Excel 1 June 1st 05 12:14 AM
Code to open new workbook Andrew[_27_] Excel Programming 3 January 22nd 04 01:24 PM
Workbook Open code Mike Tomasura Excel Programming 0 August 1st 03 05:32 PM
Workbook Open code Chip Pearson Excel Programming 0 August 1st 03 05:29 PM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"