title: VBA in Excel, loop continues to run
body: <p>I have a chart in Excel that I am trying to have a loop change the color of one bar in the chart and then reference a cell for the name of the exported image file.  The loop runs through multiple times and in the end i get 50 charts with the same highlighted bar with 50 different names.  My end goal is to change the color for one of the 50 bars in yellow, export that chart with with a name that is located in cell D3, then change all the bars back to the same color, move on to the next bar, change it to yellow and export the chart with a name that is located in cell D4.</p>
  
  <p>The 50 final chart names are located in the range of D3:D53.  Below is my code.  Thank you very much for your help.</p>
  
  <p>Dim i As Integer, n As Integer</p>
  
  <p>Dim part1 As String</p>
  
  <pre><code>For i = 1 To 50
  For n = 3 To 52
  part1 = Cells(n, 4)
  
  ActiveChart.SeriesCollection(1).Select
  ActiveChart.SeriesCollection(1).Points(i).Select
  With Selection.Format.Fill
      .Visible = msoTrue
      .ForeColor.RGB = RGB(255, 255, 0)
      .Transparency = 0
      .Solid
  End With
  
  ActiveSheet.ChartObjects("Chart 1").Activate
  
  ActiveChart.Export "ImageSaveLocation" &amp; part1 &amp; ".png"
  
  
  ActiveChart.SeriesCollection(1).Select
  With Selection.Format.Fill
      .Visible = msoTrue
      .ForeColor.RGB = RGB(0, 112, 192)
      .Transparency = 0
      .Solid
  End With
  
          Next n
      Next i
  </code></pre>
  
  <p>End Sub</p>