I would like to make a graph with vba where there is a stacked column and a line which use two different axes. Any ideas how to do this?
This is easily possible when manually using chartwizard, but I can't find any resources on how to do it through VBA.
Attached is a snapshot of what the manually made final product looks like.
So far, I have this which creates the chart for me, and I was hoping to format series (7) to be the line. Obviously, what I already have is incorrect.
Code
'Variables
Dim rng As Range
Dim cht As Object
'Data range for the chart
Set rng = ActiveSheet.Range(ActiveCell.End(xlToLeft), ActiveCell.End(xlDown).End(xlDown))
'Create chart
Set cht = ActiveSheet.Shapes.AddChart2
'Give chart data
cht.Chart.SetSourceData Source:=rng
'Determine the chart type
cht.Chart.ChartType = xlColumnStacked
'Series editing
cht.Chart.FullSeriesCollection(7).Format.Line.Visible = msoTrue
Display More
Thank you!