ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turn on secondary axis (https://www.excelbanter.com/excel-programming/406562-turn-secondary-axis.html)

Edward Ulle[_2_]

Turn on secondary axis
 
I've search and tried everything I can think of to turn on the secondary
axis. I've even recorded a macro to see what Excel does but no luck.

Set c = Charts.Add
With c
.HasAxis(xlValue, xlSecondary) = True
.Axes(xlValue, xlSecondary).CategoryType = xlAutomatic
End With


I get "Method 'Axes' of objecty '_Chart' failed".

What am I doing wrong?

*** Sent via Developersdex http://www.developersdex.com ***

Edward Ulle[_2_]

Turn on secondary axis
 
Sorry folks. I figured it out.

I guess you can't have a secondary axis until you have one or maybe
multiple series in your chart.

I moved the code down after the series were created and voila it works.




*** Sent via Developersdex http://www.developersdex.com ***

Jon Peltier

Turn on secondary axis
 
You need at least two series, one for the primary axis, the other for the
secondary.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Edward Ulle" wrote in message
...
Sorry folks. I figured it out.

I guess you can't have a secondary axis until you have one or maybe
multiple series in your chart.

I moved the code down after the series were created and voila it works.




*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com