title: VBA Run-Time error '9' (Subscript out of range) on transfered in worksheet
body: <p>This is my first post and I new to programming in VBA. I have a large excel file where I am trying to create a macro to delete multiple tabs. My code is as followed it works as I am prompted with a do I wish to permanently delete:</p>
  
  <pre><code>Option Explicit
  
  Sub delSheet()
  
  Worksheets("sheet2").Delete
  
  End Sub
  </code></pre>
  
  <p>However when I transfer in a tab (tab name is "sheet92') from another file I get this error using the same code</p>
  
  <pre><code>Option Explicit
  
  Sub delSheet()
  
  Worksheets("sheet92").Delete
  
  End Sub
  </code></pre>
  
  <p>What is causing the code to delete the sheet2 which is the tab that I created within opening a .xlsb file and creating a new sheet vs. the error message on copying into the file from an existing file? Thank you advance for your help.</p>