• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Configure Secondary chart axis by VBA

Hello,


I am using this code to change my chart type from line to coloum and it worked fine to me by now.

[pre]
Code:
Private Sub ComboBox3_Change()
Const CHART_TYPE_COLUMN = "Line chart"
Const CHART_TYPE_LINE = "Coloum chart"

With Worksheets("Management_Dashboard").ChartObjects("Chart 2").Chart
Select Case [chart_type]
Case CHART_TYPE_COLUMN
.ChartType = xlColumnClustered
Case CHART_TYPE_LINE
.ChartType = xlLineMarkers

End Select

End With
[/pre]

Now I need to plot chart with two series and want to have one on series on secondary. How can i configure this as ChartType = xlLineMarkers gives a single axis chart.


Regards,
 
The trick is to apply the chart type to a specific series. For example, this will change series 2 to a LineMarkers.

Code:
ActiveChart.SeriesCollection(2).ChartType = xlLineMarkers

Hope that points you in the right direction.
 
Just a blind guess. i am understanding this code as this will change the series 2 type to line

while requirement is plot both the series as line but on different axis.


Am i understating wrong?


Anyway thanks Luke, i will give it a try tomorrow.


i feel so fortunate to be the part of this forum. i am learning to implement my imagination by the help of you experienced guys.
 
Hi KPJ,


I think your best shot would be to just record a macro of you doing the actions you want, and then pare down the recording to what you actually want. That will give you a better baselines to work with, and should give you the actual code needed (as well as some extra "fluff" that you'll want to remove).
 
Back
Top