title: VBA Copy Sheet to End of Workbook (with Hidden Worksheets)
body: <p>I want to copy a sheet and add it to the end of all current sheets (regardless of whether the sheets are hidden).</p>
  
  <pre><code>Sheets(1).Copy After:=Sheets(Sheets.Count)
  Sheets(Sheets.Count).name = "copied sheet!"
  </code></pre>
  
  <p>This works fine, except, when there are hidden sheets, the new sheet is only inserted after the last visible worksheet, so the <code>name</code> command renames the wrong sheet.</p>
  
  <p>I have tried variations of the following to get a reference to the newly copied <code>WorkSheet</code> but none were successful and/or valid code. </p>
  
  <pre><code>Dim test As Worksheet
  Set test = Sheets(1).Copy(After:=Sheets(Sheets.Count))
  test.Name = "copied sheet!"
  </code></pre>