ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Copy charts from 1 workbook to another (https://www.excelbanter.com/charts-charting-excel/167643-copy-charts-1-workbook-another.html)

Arlette[_2_]

Copy charts from 1 workbook to another
 
I have created a macro which copies some charts from one workbook to
another. It has to repeat this for several tabs of the workbook. I
need to know if i need to create an object to copy n paste these
charts or can it be done without an object. A quick reply is
appreciated.

John Mansfield

Copy charts from 1 workbook to another
 
I believe you would just need to create a worksheet variable combined with a
worksheet loop to copy all of the charts.

If I'm understanding your question correctly, something like this should
hopefully work:

Sub CopyCharts()
Dim wks As Worksheet
Dim cht As ChartObject
For Each wks In Worksheets
For Each cht In wks.ChartObjects
'Your copy and paste code here.
Next cht
Next wks
End Sub

--
John Mansfield
http://cellmatrix.net





"Arlette" wrote:

I have created a macro which copies some charts from one workbook to
another. It has to repeat this for several tabs of the workbook. I
need to know if i need to create an object to copy n paste these
charts or can it be done without an object. A quick reply is
appreciated.


Arlette[_2_]

Copy charts from 1 workbook to another
 
What if there are about 10 charts and i have to copy just 5 of them?
Should i create objects for each of these 5 to be copied?


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com