ronjon65
07-10-2018, 06:06 PM
I am trying to set scale for many charts..."Chart 1", "Chart 2",... I tried some code that would operate on all the charts, but I couldn't get it to work. It needs to work for 2003+. Ideally, it would be best not to activate the chart since I *think* it sometimes causes the chart to flash in some Excel versions (even with screenupdating turned to false). For now, I just have the following code for each chart. It works, but it doesn't seem very efficient and is slow on some computers when there are a lot of charts. Any ideas on how to make it faster and avoid the flashing?
ActiveSheet.ChartObjects("Chart1").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = Cells(13, 5)
.MaximumScale = (12, 5)
.Crosses = xlCustom
.CrossesAt = (13, 5)
End With
With ActiveChart.Axes(xlValue)
.MinimumScale = (18, 1)
.MaximumScale = (17, 1)
.Crosses = xlCustom
.CrossesAt = (18, 1)
End With
ActiveSheet.ChartObjects("Chart1").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = Cells(13, 5)
.MaximumScale = (12, 5)
.Crosses = xlCustom
.CrossesAt = (13, 5)
End With
With ActiveChart.Axes(xlValue)
.MinimumScale = (18, 1)
.MaximumScale = (17, 1)
.Crosses = xlCustom
.CrossesAt = (18, 1)
End With