title: Excel 2007 VBA: Selecting Sheet With a Variable
body: <p>I'm trying to reference a sheet based on a variable.</p>
  
  <p>From a top level, I have a For loop driven by the variable Num = 1 To 18
  The variable "CurrentSN" changes value based on a list of serial numbers on sheet ("SN's"). </p>
  
  <pre><code>Dim Num As Integer 
  Dim CurrentSN As String
  
  CurrentSN = Sheets("SN's").Cells(Num, 1).Value
  </code></pre>
  
  <p>18 pre-existing sheets are in the workbook, each named with one of these serial numbers (18 total). I want to refer to the appropriate sheet for each loop so I used...</p>
  
  <pre><code>Sheets(CurrentSN).Range("A1").Select
  </code></pre>
  
  <p>Unfortunately, it is erroring out on this line. Where am I going wrong here?</p>