VBA to extract series name, X, and Y values from Excel Chart
<p>I was looking for help on extracting data from an excel chart.  Specifically, I need to pull <strong>series names</strong>, <strong>X</strong>, and <strong>Y</strong> values from all points on the chart. I started with the basic code from Excel but it is only giving me X values. </p>

<pre><code>Sub GetChartValues()
Dim NumberOfRows As Integer
Dim X As Object
Counter = 2

' Calculate the number of rows of data.
NumberOfRows = UBound(ActiveChart.SeriesCollection(1).Values)

Worksheets("ChartData").Cells(1, 1) = "X Values"

' Write x-axis values to worksheet.
With Worksheets("ChartData")
  .Range(.Cells(2, 1), _
  .Cells(NumberOfRows + 1, 1)) = _
  Application.Transpose(ActiveChart.SeriesCollection(1).XValues)
End With

' Loop through all series in the chart and write their values to
' the worksheet.
For Each X In ActiveChart.SeriesCollection
  Worksheets("ChartData").Cells(1, Counter) = X.Name

  With Worksheets("ChartData")
     .Range(.Cells(2, Counter), _
     .Cells(NumberOfRows + 1, Counter)) = _
     Application.Transpose(X.Values)
  End With

  Counter = Counter + 1
Next

End Sub
</code></pre>

<p>I need to figure out how to make this work so I can create tables of the given values. I have also attached an image of the chart I am working on. Any help would really be appreciated!</p>

<p><img src="https://i.stack.imgur.com/G9Syg.jpg" alt="Chart Picture"></p>

<p><img src="https://i.stack.imgur.com/uk092.jpg" alt="Station Timetable Picture"></p>