Hi
combining a conventional line and scatter series in the same chart can be problematic as the conventional line series will not be able to have different x values to the other series unless it is on a different x axis. However, if you are happy for your first series to be in xy format but appearing as a line (ie with a line and no markers) then this macro should create a chart in that format:
Sub CreateChart()
Dim NewS
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select
ActiveChart.SetSourceData Source:=Range("Sheet1!$A$1:$B$24")
Set NewS = ActiveChart.SeriesCollection.NewSeries
With NewS
.Values = Range("$d$2:$d$7")
.XValues = Range("c$2:$c$7")
.Name = Range("$d$1")
End With
Set NewS = ActiveChart.SeriesCollection.NewSeries
With NewS
.Values = Range("$f$2:$f$7")
.XValues = Range("e$2:$e$7")
.Name = Range("$f$1")
End With
With ActiveChart.SeriesCollection(1)
.Format.Line.Visible = msoTrue
.MarkerStyle = xlNone
End With
End Sub
Bookmarks