I have a macro called CalcAll that is called form a number of places. CalcAll runs 4 macros in succession doing different types of calculations (thousands). Those 4 run in less than a second. I moved additional calls to 4 chart creation subs, each creating a chart based upon the calculated data. The problem is with Charts 2 and 3. Charts 1 and 4 always run fine. If I run CalcAll where everything runs in succession (with no lines of code between the calls), I get these times for Charts 2 and 3 (3 runs):
Run in succession
Chart2 Created = 64.35938
Chart2 Created = 22.91016
Chart2 Created = 188.9766
Chart3 Created = 120.4336
Chart3 Created = 21.86719
Chart3 Created = 174.7305
But I can run the chart subs one by one from ribbon controls. And when I run them individually, I get times like this:
Manually triggered:
Chart2 Created = 0.1015625
Chart2 Created = 0.109375
Chart3 Created = 0.1015625
Chart3 Created = 8.984375E-02
As you can see the times are radically different and problematic. I have spent days trying to isolate. It is time consuming and frustrating when it takes any where from 4 to 20 minutes to run. In short, the chart code does this:
It then calls another sub to create a Common Create_Ttable below the chart. But the times above do not include the running of the Create_Ttable sub.
Anyone have any advice or things I can check?
Run in succession
Chart2 Created = 64.35938
Chart2 Created = 22.91016
Chart2 Created = 188.9766
Chart3 Created = 120.4336
Chart3 Created = 21.86719
Chart3 Created = 174.7305
But I can run the chart subs one by one from ribbon controls. And when I run them individually, I get times like this:
Manually triggered:
Chart2 Created = 0.1015625
Chart2 Created = 0.109375
Chart3 Created = 0.1015625
Chart3 Created = 8.984375E-02
As you can see the times are radically different and problematic. I have spent days trying to isolate. It is time consuming and frustrating when it takes any where from 4 to 20 minutes to run. In short, the chart code does this:
VBA Code:
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
...
deletes existing chart
dynamically creates new chart
sets chart type, size, style, etc
...
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Anyone have any advice or things I can check?