Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copying and Pasting Worksheet between workbooks

Got workbook A with 2 sheets (A1 and A2). A2 has tables, and A1 has charts
that are based on the tables in A2.

I need to write a macro, that will create a new workbook (B), will copy A2,
paste it into B, then copy A1 and paste it into B, before B.A2, and
recalculate Charts in B.A1 based on tables in B.A2.

What macro do I need to write ? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Copying and Pasting Worksheet between workbooks


"fbagirov" wrote in message
...
Got workbook A with 2 sheets (A1 and A2). A2 has tables, and A1 has charts
that are based on the tables in A2.

I need to write a macro, that will create a new workbook (B), will copy
A2,
paste it into B, then copy A1 and paste it into B, before B.A2, and
recalculate Charts in B.A1 based on tables in B.A2.

What macro do I need to write ? Thanks!


Have you tried the macro recorder to get an idea of the code
required..thatmight be a good starting point.

Best

N10 :)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copying and Pasting Worksheet between workbooks

Yes, I've done that.
This code did not work :

Sub CopyWorkbooks()

Dim WS1 as Worksheet
DIM WS2 as Worksheet
DIM WBNew as Workbook

Set WS1 = Sheets("A1")
Set WS2 = Sheets("A2")

'do something

Set WBNew=Workbooks.Add
With WBNew
.Title = B
End With

'do paste of tables from sheet A2
.....

'Paste the whole sheet A1 into B - DOES NOT WORK
WS1.Copy
WBNew.Sheets.Add
WS1.Paste

End Sub


I am confused about references to workbooks A1 and A2. I don't know how many
workbooks are going to be open on user's desktop, so I can't refer to them as
Workbooks(1), workbooks(2), etc.



"N10" wrote:


"fbagirov" wrote in message
...
Got workbook A with 2 sheets (A1 and A2). A2 has tables, and A1 has charts
that are based on the tables in A2.

I need to write a macro, that will create a new workbook (B), will copy
A2,
paste it into B, then copy A1 and paste it into B, before B.A2, and
recalculate Charts in B.A1 based on tables in B.A2.

What macro do I need to write ? Thanks!


Have you tried the macro recorder to get an idea of the code
required..thatmight be a good starting point.

Best

N10 :)



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 to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Copying and Pasting a Worksheet Jim Pockmire Setting up and Configuration of Excel 1 September 8th 05 02:57 PM
Copying and Pasting between Workbooks NothingButRomance Excel Worksheet Functions 0 May 13th 05 09:54 PM
Copying and Pasting between Workbooks NothingButRomance Excel Worksheet Functions 0 May 13th 05 07:33 PM
Copying and Pasting in a different worksheet (Urgent) Lolly[_2_] Excel Programming 4 August 24th 04 02:29 PM


All times are GMT +1. The time now is 11:37 AM.

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

About Us

"It's about Microsoft Excel"