Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to Improve Code Copying/Pasting Between Workbooks | Excel Discussion (Misc queries) | |||
Copying and Pasting a Worksheet | Setting up and Configuration of Excel | |||
Copying and Pasting between Workbooks | Excel Worksheet Functions | |||
Copying and Pasting between Workbooks | Excel Worksheet Functions | |||
Copying and Pasting in a different worksheet (Urgent) | Excel Programming |