Chart_Calculate event - code looping

RobH1979

New Member
Joined
Mar 9, 2009
Messages
9
Hi

I've got a pivot chart in Excel 2000, but have the common problem that I can't change the format of the chart because it re-sets itself to it's original format each time it updates. I need to put a series on a second y axis.

I've been using the Chart_Calculate event to make the change to the second y axis, so that everytime the chart is updated it will apply my desired formatting rather than reverting to the standard. However the code (below) loops on every update. When it reaches the '.TickLabel' line is go straight back to the 'Private Sub' line. I assume therefore that changing the number format is forcing the chart to re-calculate. Is there anyway I can get round this?

Private Sub Chart_Calculate()
'Put % series on secondary Y axis and make axis match series
ActiveChart.SeriesCollection(3).AxisGroup = 2
With ActiveChart.Axes(xlValue, xlSecondary)
.HasTitle = True
.AxisTitle.Characters.Text = "Percentage of Callout Charges >10% above mean"
.TickLabels.NumberFormat = "0.0%"
End With

End Sub

Thanks
Rob
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

RobH1979

New Member
Joined
Mar 9, 2009
Messages
9
Sorted this myself. Put Application.EnableEvents = FALSE before the code and turn it back to TRUE afterwards
 
Upvote 0

Forum statistics

Threads
1,190,558
Messages
5,981,685
Members
439,729
Latest member
purna

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top