Hello there, I have some issues creating a chart.


Context:
I have to create a milestone slip chart (time-time chart). In order to achieve this I have:

- one column with the date of every day on a certain number of years (represents my X axis)
Content in this column goes from cell (3,3) to cell (i -1 ,3)

- 9 columns of values (one for each milestone). The cells in these columns have either a value or no value ( this value is a date and is linked to a date on the x axis) (column index = 5,7,9... = 2 + k * 2 with k from 1 to 8)

I need to plot a line for each milestone.

here is my code:



Set sh = ActiveWorkbook.Worksheets("Milestones")
Set chrt = sh.Shapes.AddChart.Chart

For k = 1 To 9
 With Sheets("Milestones")
 chrt.SeriesCollection.NewSeries
    chrt.SeriesCollection(" & k & ").XValues = _
        .Range(Cells(3, 3), Cells(i-1, 3))
    chrt.SeriesCollection(" & k & ").Values = _
        .Range(Cells(3, k*2+2), Cells(i-1, k*2+2))
End With
next k
but it shows a run-time error 1004 ( application-defined or object-defined error) at this part of code
chrt.SeriesCollection(" & k & ").XValues = _
        .Range(Cells(3, 3), Cells(i-1, 3))
I have looked for hours on the net to find a solution and tried different syntax but nothing seems to work due to the variables i and k

Thanks in advance