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" <(E-Mail Removed)> wrote in message
> news:94875AD6-AE31-46D2-8763-(E-Mail Removed)...
> > 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 
>
>
>