Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart copy to another workbook

Status
Not open for further replies.

Rome75

Programmer
Jul 11, 2003
8
IT
I have a workbook with few sheets and macros developing some results and charts.

I have to copy all the results and charts to another sheets with just values (no formulas).

I'm able to copy and paste special through VBA all the Calculation sheets but copying and pasting the chart it will retain the original sheet reference.
Example: Chart1 in original.xls will take x and y from a sheet in original.xls called datasheet

I copied all the values of datasheet in the new workbook and I'd like to have chart1 without having to rebuild the chart from screcth.
is it possible to copy and paste the chart from a workbook to another with a relative reference in the way that it will get data from the sheet "datasheet" of the new workbook??

thanks a lot

Fernando Nardi
 
Rome75,

What is your objective?

Will the new chart be reflecting CHANGES in the data in the new workbook?

If the new workbook is merely a copy of the original data for display purposes, then you might consider EXPORTING the chart to a GIF and INSERTING the GIF in the new workbook along with the data values. See thread707-666677.

Post back if this is NOT what your objective is.

Skip,
Skip@TheOfficeExperts.com
 
I tend to use:


Sheets(Array("Data","Chart1")).Copy
ActiveWorkbook.SaveAs FileName:="C:\temp.xls"



This copies the sheets to a new workbook, and the saveas assigns the new workbook a name and drive location.

Note that if you copy the chart sheet only, the links to the old file will still be there, so you have to copy the data sheet as well. Once in the new workbook, you can go to the "Data" sheet and do a

cells.copy
cells.pastespecial paste:=xlvalues


Other than this, I know of no way of breaking links from chart objects (whether sheets or objects on the sheet) - they seems to have to have a data sheet whether in their own workbook or another workbook.

The only other thing is:

Sheets("Chart1").Export Filename:="C:\Temp.GIF", FilterName:="GIF", Interactive:=True


This gives you a static image, but it's just that: a GIF or JPEG or whatever.



Does this help at all?


Cheers,

Aeneas
 
Thanks very much to both.
I really appreciated your help ans solved my problems.

Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top