title: VBA Codename Reference
body: <p>I wish to reference my worksheets via codenames as part of a longer vba code - the current code I have is:</p>
  
  <p>Works correctly:</p>
  
  <pre><code>If wb.Sheets("stage 1").Visible = xlVeryHidden Or wb.Sheets("stage 1").Visible = xlHidden Then wb.Sheets("Stage 1").Visible = True
  </code></pre>
  
  <p>Which I want to change to the below - "Stage 1" = Sheet8 within my excel file </p>
  
  <pre><code>If wb.Sheet8.Visible = xlVeryHidden Or wb.Sheet8.Visible = xlHidden Then wb.Sheet8.Visible = True
  </code></pre>
  
  <p>However upon changing the code it provides a runtime error 438. </p>
  
  <p>Can someone advise how I can overcome this issue or where my code is incorrect?</p>
  
  <p>Thanks in advance</p>