Position vertical axis

K

Ken

I have two charts that have the same category data but different y-axis. I
would like to keep the vertical axis for both charts aligned. The bottom
chart is populated via VBA & the y values can range from 0.1 to millions.
How do I pin the y-axis so that it does not reposition itself when the
magnitude of the axis label changes?
 
A

Andy Pope

Hi,

Either use code to set the min/max values of the axes in both charts.
Or add a dummy series that contain the min and max value for both sets of
data. The series will cause the Auto scaling of the axes to at least be
consistent.

Cheers
Andy
 
K

Ken

Sorry I wasn't clearer. I already have code to set the max/min. What I need
to do is to fix the horizontal position of the y-axis so it doesn't change
when the axis numbers change from being short (e.g., 1) to being long (e.g.,
1,000,000). When the numbers change, Excel automatically changes the
position of the y-axis to match the length of the y-axis unit numbers.
 
A

Andy Pope

You mean the plot area resizes when the value axis changes from displaying
single digit value to 4 digit values.

You would either need to resize and position the plotarea.

Or use a dummy series to provide the Y value axis labels. This would need to
be a xy-scatter series. And you would remove built-in axis labels.

Cheers
Andy
 
K

Ken

Exactly my issue. Any way to resize via VBA? I'm trying to use the LEFT &
WIDTH of the axis & plot area to automatically figure out where the axis is
after it resizes & then resize to get the axis where I want it w/o success
 
A

Andy Pope

Hi,

You will need to adjust the WIDTH and LEFT properties of the plotarea but
you want to use the
INSIDELEFT and INSIDEWIDTH properties to determine whether you have the
correct position.

So first get the required positions, even just before changing values that
will alter the axis or from another chart.
The adjust the left and width properties whilst comparing the insideleft and
insidewidth properties.

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top