ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ChartObject.Copy very slow (https://www.excelbanter.com/excel-programming/408402-chartobject-copy-very-slow.html)

Chrisso

ChartObject.Copy very slow
 
Hi All

I have some code where I use a templated chart to make a copy:

Debug.Print " MC 0: " & Now()
Dim chtObjTemplate As ChartObject, wsCharts As Worksheet
Set wsCharts = ThisWorkbook.Sheets("Charts")
Set chtObjTemplate = wsCharts.ChartObjects("Chart 1")
chtObjTemplate.Copy
Debug.Print " MC 1: " & Now()

I am surprised to find that this takes roughly 5 seconds as the debug
statements show:
MC 0: 27/03/08 08:51:45
MC 1: 27/03/08 08:51:50

My code turns off the screen, disables events and sets calculation to
manual:
Application.ScreenUpdating = False
Application.Calculation = xlManual
Application.EnableEvents = False

So does anyone have any idea why this is taking so long and how to get
around it? This amount of time per chart copy will mean my solution
will not scale.

Is there a better way to ensure that a chart generated automatically
matches the formatting of another chart?

Thanks in advance,
Chrisso



All times are GMT +1. The time now is 06:03 PM.

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