D
daddy-o
I'm creating a chart with two data series using vba. One data series is onthe primary axis and one is on the secondary axis. In order for the chartto look correct, the two axis need to have the same max/mins. I have written code that does just this. Below is a portion of code from a much larger routine.
With ActiveChart.Axes(xlValue, xlSecondary)
.MinimumScale = ActiveChart.Axes(xlValue, xlPrimary).MinimumScale
.MaximumScale = ActiveChart.Axes(xlValue, xlPrimary).MaximumScale
End With
In my testing I'm using a chart with primary axis max=60, min=-30. Thecode always works for the maximum value. It also works perfectly for the min if I put a breakpoint in the code before "MinimumScale = ActiveChart....". However, if the code is called from Excel and runs freely (no breakpoints), or if the first breakpoint is after "MinimumScale = ActiveChart...", then VBA somehow concludes that the min=-40.
I'm finding this absolutely maddening. Does anyone know how to get Excel/VBA to work correctly?
Thanks!
With ActiveChart.Axes(xlValue, xlSecondary)
.MinimumScale = ActiveChart.Axes(xlValue, xlPrimary).MinimumScale
.MaximumScale = ActiveChart.Axes(xlValue, xlPrimary).MaximumScale
End With
In my testing I'm using a chart with primary axis max=60, min=-30. Thecode always works for the maximum value. It also works perfectly for the min if I put a breakpoint in the code before "MinimumScale = ActiveChart....". However, if the code is called from Excel and runs freely (no breakpoints), or if the first breakpoint is after "MinimumScale = ActiveChart...", then VBA somehow concludes that the min=-40.
I'm finding this absolutely maddening. Does anyone know how to get Excel/VBA to work correctly?
Thanks!