Change the maximum value of a chart's x-axis

jbpowell used Ask the Experts™
How can I set the maximum value for a chart's x axis in VB?

Say the chart is named 'Chart1' and it's a line graph.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
dsegard seems to have answered this in an earlier question at:
His answer is:

[ReferenceOfYourChart].Object.Application.Chart.axes(2).maximumscale = VALUE

You can also place a date for time scale.

Download Grphsm97.exe from
It contains a lot of VBA sample to manipulate graph.

My comment is that you may need to use (1) and not (2) in order to address the x axis versus the y axis.


Chart1.Object.Axes(xlValue).MaximumScale = x

Depending on the orientation of your graph you may wany xlCategory instead of xlValue.


This worked great, thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial