title: Deleting all the data series in a dynamic chart
body: <p>I create a dynamic chart on multiple data series according to the selection I make in the listbox (Lbox1).</p>
  
  <p>It throws an error when I delete all the data series initially to make a fresh chart.</p>
  
  <pre><code>Public Sub listbox_selection()
      Dim i As Integer
      Dim temp As String
      Dim k As Integer
      Dim s As SeriesCollection
  
      k = Sheets("Plan1").ChartObjects(1).Chart.SeriesCollection.count
  
      ##This part giving error
      For i = 1 To k
          Sheets("Plan1").ChartObjects(1).Chart.SeriesCollection(i).Delete
      Next
      ####
  
      Sheets("Plan1").ListBoxes("LBox1").Select
      For i = 1 To Sheets("Plan1").Shapes("LBox1").ControlFormat.ListCount
          If Sheets("Plan1").ListBoxes("LBox1").Selected(i) = True Then
              Call Listit(X:=i)
          End If
      Next
  End Sub
  
  Public Sub Listit(ByVal X As Integer)
      X = X + 3
      With Sheets("Plan1").ChartObjects(1).Chart
          With .SeriesCollection.NewSeries
             .XValues = Range("Q2:U2")
             .Values = Range("Q" &amp; X &amp; ":U" &amp; X &amp; "")
             .Name = Range("P" &amp; X).Value
          End With    
      End With
  End Sub
  </code></pre>