Wrox Programmer Forums
|
BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2
This is the forum to discuss the Wrox book Excel 2007 VBA Programmer's Reference by John Green, Stephen Bullen, Rob Bovey, Michael Alexander; ISBN: 9780470046432
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2011, 07:40 PM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Open, copy sheet to another workbook

How do I write a VBA code to open a file, copy certain sheet to another workbook?
Thanks
 
Old February 18th, 2011, 09:34 PM
Friend of Wrox
 
Join Date: Sep 2010
Posts: 171
Thanks: 0
Thanked 14 Times in 14 Posts
Default

like so
Code:
Sub CopySheetl()
Dim wkbSource As Workbook
Dim wkbDest As Workbook
Dim shtToCopy As Worksheet

Set wkbSource = Workbooks.Open("C:\MyWorkBookSource.xlsm")
Set wkbDest = Workbooks.Open("C:\MyWorkBookDest.xlsm")
Set shtToCopy = wkbSource.Sheets("mySheet")
shtToCopy.Copy wkbDest.Sheets(1)
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Workbook,Copy Sheet,Move Sheet, Close/Save ptrussell2009 Excel VBA 0 June 13th, 2008 02:28 PM
Copy Worksheet into another workbook money Excel VBA 4 March 8th, 2007 05:17 AM
OptionButtons as workbook sheet selector frankjuel Excel VBA 8 February 27th, 2007 05:32 PM
Copy workbook contents into new one crmpicco Excel VBA 0 May 17th, 2005 05:10 AM
Code to populate multiple sheet into workbook kud Excel VBA 0 June 9th, 2004 11:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.