Setting the minimum and maximum scale in a chart using VBA is easy. Lets' suppose the current minimum = 10 and the maximum = 20 and we want to set the new min and max to be resp 30 and 40... We would do this, right?
Code: Select all
With Charts("Name").Axes(xlCategory)
.MinimumScale = 30
.MaximumScale = 40
End With
However, the moment we set the new minimum, that value is now larger than the old maximum (=20)... wouldn't that trigger an error then??? If that would be the case, could I fix like below?
Code: Select all
With Charts("Name").Axes(xlCategory)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinimumScale = 30
.MaximumScale = 40
End With