title: VBA: Select all slides of defined sections
body: <p>I'm playing with a progress bar (with basically zero experience with VBA whatsoever). I found the following snippet online:</p>
  
  <pre class="lang-js prettyprint-override"><code>Sub ProgressBar()
      On Error Resume Next
      With ActivePresentation
      .SectionProperties.SlidesCount(
          For N = 2 To .Slides.Count
          .Slides(N).Shapes("Progress_Bar").Delete
          Set s = .Slides(N).Shapes.AddShape(msoShapeRectangle, 0, .PageSetup.SlideHeight - 10, N * .PageSetup.SlideWidth / .Slides.Count, 10)
          Call s.Fill.Solid
          s.Fill.ForeColor.RGB = RGB(128, 128, 128)
          s.Line.Visible = False
          s.Name = "Progress_Bar"
          Next N:
      End With
  End Sub
  </code></pre>
  
  <p>Note the part with <code>For N = 2 To .Slides.Count</code>. I'd like the progress bar not to reach from the second slide the last one but rather from the second slide to the last slide of the section I called "conclusion". How can I do that?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: My current workaround is a hard coded number of slides that I define as a variable at the beginning of the macro and then use the variable throughout the rest of it.</p>