title: Why does Excel create an extra series in dynamically created scatter plot with VBA?
body: <p>Good evening, I am trying to automate some data analysis and graph creation at work. The whole program is fairly big, but below you can find a snip of the part that is causing me issues.</p>
  <p>I have a listbox where the user selects which parameters to incorporate into the chart. After this the &quot;Create Graph&quot; button places these parameters in new sheet as the column headers, then it it looks for the corresponding values in a &quot;RAW DATA&quot; Sheet. All these works so far and the correct values are under their corresponding header, the problem is when I go to create the actual graphs. I used the following code to loop through the items in the listbox and create the series to be plotted maintaining the X-values constant between all of them. For some reason, I get an extra series with the X values being plotted as both X-values and Y-values. Hence the 1:1 slope. X-values are elapsed time.</p>
  <p><a href="https://i.stack.imgur.com/W1Doe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W1Doe.png" alt="enter image description here" /></a></p>
  <pre><code>Dim i3 As Integer
  Dim ChartSheet As Chart
  
  Set ChartSheet = Charts.Add
  ChartSheet.HasTitle = True
  ChartSheet.ChartTitle.Text = s
  
  With ChartSheet
              
      .ChartType = xlXYScatterLines
      
      For i3 = 1 To UserForm1.ListBox2.ListCount
      
      .SeriesCollection(i3 + 1).values = ThisWorkbook.Worksheets(s).Columns(i3 + 1)
      .SeriesCollection(i3 + 1).XValues = ThisWorkbook.Worksheets(s).Range(&quot;A:A&quot;)
      Next i3
      
  End With
  
  ActiveChart.SetElement (msoElementLegendBottom)
  </code></pre>