title: Using VBA to Loop Through Sheets with a Specific Name
body: <p>I am trying to build a macro to run through a file and open a userform for every sheet that has the name "File-n" where n is an integer. I've tried this code, but it doesn't work:</p>
  
  <pre><code>Dim WS As Worksheet
  Dim indx As Integer
  
  For Each WS In ThisWorkbook.Worksheets
      WS.Activate
  
      If WS.Name = "File-" &amp; indx Then
          WS.Select
          userform1.show
      End If
  
  Next WS
  </code></pre>
  
  <p>This macro doesn't recognize any sheets. The code below works, but I was hoping to clean it up if possible. I don't like listing out the potential number of sheets up to thirty.</p>
  
  <pre><code>If WS.Name = "File-0" or WS.Name = "File-1" or WS.Name = "File-2" or ... Then
  </code></pre>