Secondary axis title set up

gwandalf

New Member
Joined
Feb 16, 2011
Messages
30
Hi!!! I would like to know how to set the secondary axis title to my chart. But it is giving my problems. Like this is telling me that
Method ?Axes'_Chart' failed and I dont know why


ActiveSheet.ChartObjects(chartName(2)).Activate
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.SetElement (msoElementSecondaryValueAxisTitleRotated)
ActiveChart.seriesCollection.NewSeries
ActiveChart.seriesCollection(1).Name = "Hv"
ActiveChart.seriesCollection(1).XValues = simNo
ActiveChart.seriesCollection(1).Values = Hvdata
ActiveChart.seriesCollection.NewSeries
ActiveChart.seriesCollection(2).Name = "Freq"
ActiveChart.seriesCollection(2).AxisGroup = 2
ActiveChart.seriesCollection(2).Values = Fdata

Thanks in advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
And the second line was highlighted? (Important information, remember to include it.)

Does the chart have a secondary value axis? It looks like it isn't added until the second to last line of code.
 
Upvote 0
Yes, the second line was highlighted (Thanks for the advice :) )

The chart has a secondary vertical axis, yes. But I dont know what you meanthat I should add it before. Sorry I am a begginer in VBA. COuld you explain me how did you do that?

Thanks in advance
 
Upvote 0
And the second line was highlighted? (Important information, remember to include it.)

Does the chart have a secondary value axis? It looks like it isn't added until the second to last line of code.


Yes, the second line was highlighted (Thanks for the advice :smile: )

The chart has a secondary vertical axis, yes. But I dont know what you meanthat I should add it before. Sorry I am a begginer in VBA. COuld you explain me how did you do that?

Thanks in advance
 
Upvote 0
I mean, at that point in the code, does the chart have a secondary value axis? You can't add/format the axis title if there is no corresponding axis.

If it didn't have the secondary axis at the beginning of the code, it doesn't get one until you assign a series to the secondary axis (AxisGroup=2).

Move the code that formats this axis after the part that formats the series in the chart.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top