In another thread (https://www.excelforum.com/excel-pro...y-columns.html) I asked for advice on adding one series at a time to a chart created in VBA.

Now I would like to add a horizontal (and eventually vertical) line to the chart. The existing code is:

Private Sub plotStuff()
    
    Dim x As Long
    Dim y As Long
    
    x = Range("Components").Row
    y = 1

    ActiveSheet.Shapes.AddChart(xlXYScatterLines).Select

    Do While Range("B" & x) <> ""
        With ActiveChart
            .ChartType = xlXYScatterLines
            If ActiveSheet.Range("D" & x).Value = "Yes" Then
                .SeriesCollection.NewSeries
                .FullSeriesCollection(y).Name = ActiveSheet.Range("A" & x)
                .FullSeriesCollection(y).Values = ActiveSheet.Range("C" & x & ":C" & x + 1)
                .FullSeriesCollection(y).XValues = ActiveSheet.Range("B" & x & ":B" & x + 1)
                y = y + 1
            End If
            x = x + 2
        End With
    Loop

End Sub
How could I then add a horizontal line to the chart where the two y values are just the value stored in a single cell F1, the initial x value is 0 and the final x value is in cell F2?

I've been trying to use a similar setup to the code above however I can't figure out how to add single x or y values to the series collection. I'm trying to avoid having to explicitly store x and y values in adjacent cells, especially since for the horizontal line the y values are simply the repetition of a single number.