Problems with Secondary X Axis

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi All

Ihaving problems trying to generate a secondary X-Axis.
The problem I trying to solve is:
I have data (Y-Axis)plotted as a function of Distance in
Miles (X-Axis). What I would like is to have a secondary X
axis with the distance in Kilometers as well as Miles on
the Primary X-Axis. I am using Office 2000.

I tried using:

With ActiveChart
.Axes(xlCategory, xlSecondary).MinimumScale = _
.Axes(xlCategory, xlPrimary).MinimumScale
.Axes(xlCategory, xlSecondary).MaximumScale = _
.Axes(xlCategory, xlPrimary).MaximumScale
.Axes(xlCategory, xlSecondary).MajorUnit = _
.Axes(xlCategory, xlPrimary).MajorUnit
End With


I get an Error "unable to set the MinimumScale property of
Axis class"

Is there another way? Help


Jack
 
Jack -

You need to have at least one series for each axis group. If you need a
dummy series, plot the same series twice, then format the second series
to be invisible (no lines, no markers), and put it on the secondary axis.

If the secondary axis is a category type (i.e., it's a line chart, not a
scatter chart), .MinimumScale and .MaximumsScale are meaningless, and
you'd get a similar error.

Also, don't forget the conversion factor between miles and kilometers
needed in the code you posted.

- Jon
 
Jon

Hi, Thanks for the quick response. but I am using 2 series
and both are scatter charts.
Also I can't get the x-axis secondary to be an option.

This is the code I used:

ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=hpepupperf!
R6C20:R75C20"
ActiveChart.SeriesCollection(2).Values = "=hpepupperf!
R6C18:R75C18"
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).AxisGroup = 2
With ActiveChart
.Axes(xlCategory, xlSecondary).MinimumScale = _
.Axes(xlCategory, xlPrimary).MinimumScale
.Axes(xlCategory, xlSecondary).MaximumScale = _
.Axes(xlCategory, xlPrimary).MaximumScale
.Axes(xlCategory, xlSecondary).MajorUnit = _
.Axes(xlCategory, xlPrimary).MajorUnit
End With
 
When you put a series on the secondary axis, Excel at first only draws
the secondary Y axis, as if you don't know what you want. Right click on
the chart, select Chart Options, click on the Axes tab, and check the
secondary X axis box (and uncheck the secondary Y box if you want).

- Jon
 
Back
Top