Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Worksheets from one book to another?

Hello, I was curious if I have two workbooks, and I would like to cop
worksheet 1 from book 1 to worksheet 1 on book 2, how would I go abou
doing this? How would I execute this code in VB?

thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Copy Worksheets from one book to another?

Hi
try recording a macro while doing the following manually:
- assumption: both workbooks are opened
- activate the source workbook
- select the tab and right-click on the tab name
- choose Move7Copy
- select the target workbook + location

--
Regards
Frank Kabel
Frankfurt, Germany

"Jonx " schrieb im Newsbeitrag
...
Hello, I was curious if I have two workbooks, and I would like to

copy
worksheet 1 from book 1 to worksheet 1 on book 2, how would I go

about
doing this? How would I execute this code in VB?

thanks.


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Worksheets from one book to another?

well there is an actual method for copying the worksheets. It goe
something like:

ThisApplication.ActiveWorkbook.Sheets(1).Copy( _
After:=ThisApplication.ActiveWorkbook.Sheets(3))


which will copy worksheet 1 and place it after worksheet 3 from th
same workbook. I tried playing witrh the code to copy it on differen
workbooks, and I got an error saying copy method faile

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Worksheets from one book to another?

The sheet already exists in both workbooks?
Dim rng1 as Range, rng2 as Range
set rng1 = workbooks("book1.xls").worksheets(1).Cells
set rng2 = workbooks("Book2.xls").worksheets(1).Cells
rng1.copy Destination:=rng2

--
Regards,
Tom Ogilvy

"Jonx " wrote in message
...
Hello, I was curious if I have two workbooks, and I would like to copy
worksheet 1 from book 1 to worksheet 1 on book 2, how would I go about
doing this? How would I execute this code in VB?

thanks.


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Worksheets from one book to another?

If the sheet doesn't already exist in the second workbook:

With Workbooks("Book2.xls")
Workbooks("Book1.xls").worksheets(1).copy After:= _
.Worksheets(.worksheets.count)
End With

copies it to the end of Book2.xls

--
Regards,
Tom Ogilvy


"Jonx " wrote in message
...
well there is an actual method for copying the worksheets. It goes
something like:

ThisApplication.ActiveWorkbook.Sheets(1).Copy( _
After:=ThisApplication.ActiveWorkbook.Sheets(3))


which will copy worksheet 1 and place it after worksheet 3 from the
same workbook. I tried playing witrh the code to copy it on different
workbooks, and I got an error saying copy method failed


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Worksheets from one book to another?

Thanks To

--
Message posted from http://www.ExcelForum.com

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
Moving worksheets to another book - 2nd book will not appear jb0100 Excel Discussion (Misc queries) 2 March 18th 09 03:09 PM
copy worksheets to new book without linking to original book Lori Excel Discussion (Misc queries) 2 March 4th 09 04:46 PM
How Do I Tie Worksheets to one Work book? Bettine S Cavanaugh Excel Worksheet Functions 2 March 31st 08 04:01 AM
How many worksheets in a book? Kaitlin.uk Excel Discussion (Misc queries) 3 January 25th 07 04:04 AM
Moving worksheets in a book Drakkip Excel Worksheet Functions 5 February 18th 05 01:24 AM


All times are GMT +1. The time now is 03:31 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"