title: How to change series name in VBA
body: <p>I have a series of charts I am creating using VBA (code below).</p>
  
  <p>I am having trouble changing the names of the series from series 1 and series 2 to Current State and Solution State.</p>
  
  <p>I keep getting an </p>
  
  <blockquote>
    <p>Object Variable or With Block Variable not set</p>
  </blockquote>
  
  <p>error.</p>
  
  <p>However without the <code>srs1</code> and <code>srs2</code> code the charts work just fine (just with the wrong series names).</p>
  
  <p>I looked up how to fix this and the answer I received however is not working for me.<br>
  Does anyone know another way to do this?  </p>
  
  <pre><code>Sub MA()
      Dim Srs1 As Series
      Dim Srs2 As Series
      Dim i  As Integer
      Dim MAChart As Chart
      Dim f As Integer
      f = 2 * Cells(2, 14)
       For i = 1 To f Step 2
          Set MAChart = ActiveSheet.Shapes.AddChart(Left:=750, Width:=400, Top:=130 + 50 * (i - 1), Height:=100).Chart
           With MAChart
           .PlotBy = xlRows
           .ChartType = xlColumnClustered
           .SetSourceData Source:=ActiveSheet.Range("Q" &amp; 1 + i &amp; ":Z" &amp; 2 + i)
           .Axes(xlValue).MaximumScale = 4
           .Axes(xlValue).MinimumScale = 0
           .HasTitle = True
           .ChartTitle.Text = "Provider Load for " &amp; Cells(i + 1, 15)
           'where errors start- works fine up to this point
           Set Srs1 = ActiveChart.SeriesCollection(1) 
           Srs1.Name = "Current State"
           Set Srs2 = ActiveChart.SeriesCollection(2) 
           Srs2.Name = "Proposed Solution"
           End With
      Next i
  End Sub
  </code></pre>