F
Frank
Here is my routine:
Do Until .Axes(xlValue).MaximumScale - .Axes(xlValue).MajorUnit <
Application.Max(Cht_data)
..Axes(xlValue).MaximumScale = .Axes(xlValue).MaximumScale
- .Axes(xlValue).MajorUnit
Loop
Do Until .Axes(xlValue).MinimumScale + .Axes(xlValue).MajorUnit >
Application.Min(Cht_data)
..Axes(xlValue).MinimumScale = .Axes(xlValue).MinimumScale
+ .Axes(xlValue).MajorUnit
Loop
It works great except when Application.Max(Cht_data) is too close
to .Axes(xlValue).MaximumScale. Then the axis width is too large.
If I manually edit the axis and enter the same maximum number, then
the width is back to a standard width.
I’ve tried to use a variable instead or use this code
ActiveChart.Axes(xlValue).Select
With Selection
..MaximumScale = .MaximumScale (or alternatively .MaximumScale =
my_variable_maximum)
End With
It does not work.
I’ve googled my routine but it returned nothing.
Any thoughts?
Do Until .Axes(xlValue).MaximumScale - .Axes(xlValue).MajorUnit <
Application.Max(Cht_data)
..Axes(xlValue).MaximumScale = .Axes(xlValue).MaximumScale
- .Axes(xlValue).MajorUnit
Loop
Do Until .Axes(xlValue).MinimumScale + .Axes(xlValue).MajorUnit >
Application.Min(Cht_data)
..Axes(xlValue).MinimumScale = .Axes(xlValue).MinimumScale
+ .Axes(xlValue).MajorUnit
Loop
It works great except when Application.Max(Cht_data) is too close
to .Axes(xlValue).MaximumScale. Then the axis width is too large.
If I manually edit the axis and enter the same maximum number, then
the width is back to a standard width.
I’ve tried to use a variable instead or use this code
ActiveChart.Axes(xlValue).Select
With Selection
..MaximumScale = .MaximumScale (or alternatively .MaximumScale =
my_variable_maximum)
End With
It does not work.
I’ve googled my routine but it returned nothing.
Any thoughts?