title: Excel Sheet Index Identify by Unique Number in a VBA Macro?
body: <p>Two working macro’s for Checklists &amp; Templates below</p>
  
  <p>Workbook = Steve
  Sheet within workbook has been allocated 15286</p>
  
  <p>I need to add sheets to a macro and need to know how to locate what I assume is a unique _number, so that I can perform the same routine on a new data sheet within Same workbook</p>
  
  <p>The workbook contains the same macro, several times the only difference being a number</p>
  
  <p>Eg: Checklists =</p>
  
  <pre><code>Sub PublishChecklists()
  '
  ' Saves htm version of Sheet on Server
  '
  Range("M8:M2000").Select
  Selection.Font.ColorIndex = 0
  Selection.autofilter Field:=7, Criteria1:=Array("&lt;&gt;Exc")
  Columns("A:J").Select
  Selection.EntireColumn.Hidden = True
  With ActiveWorkbook.PublishObjects("Steve_**15826**")
  .Title = "CHECKLIST LIST"
  .Filename = "\\f:\data\Work\Checklists.htm"
  .Publish (True)
  .AutoRepublish = False
  End With
  ChDir "F:\data\Work\Today's Work"
  Columns("A:J").Select
  Selection.EntireColumn.Hidden = False
  Selection.autofilter Field:=7
  Columns("H:H").Select
  Selection.EntireColumn.Hidden = True
  Range("L8").Select
  
  End Sub
  </code></pre>
  
  <p>Templates =</p>
  
  <pre><code>Sub PublishTemplates()
  '
  ' Saves htm version of Sheet on Server
  '
  Range("M8:M2000").Select
  Selection.Font.ColorIndex = 0
  Selection.autofilter Field:=7, Criteria1:=Array("&lt;&gt;Exc")
  Columns("A:J").Select
  Selection.EntireColumn.Hidden = True
  With ActiveWorkbook.PublishObjects("Steve_**3496**")
  .Title = "TEMPLATES LIST"
  .Filename = "\\f:\data\Work\Templates.htm"
  .Publish (True)
  .AutoRepublish = False
  End With
  ChDir "F:\data\Work\Today's Work"
  Columns("A:J").Select
  Selection.EntireColumn.Hidden = False
  Selection.autofilter Field:=7
  Columns("H:H").Select
  Selection.EntireColumn.Hidden = True
  Range("L8").Select
  
  End Sub
  </code></pre>
  
  <p>--</p>
  
  <p>Both work, the only thing that appears different is the "15286" &amp; "3486", as they are different sheets?
  if I add a new sheet, I need to know, how I can locate the "3486" number bit as it will be a different number for a new sheet</p>
  
  <p>I inherited the code and have no idea how the  were found in order for them to be placed in the above code</p>
  
  <p>Many thanks for your time</p>
  
  <p>Steve</p>