title: Excel VBA WorkSheet.Copy After Excel 2013
body: <p>I want to copy a worksheet and place it DIRECTLY after another sheet. But I having trouble when there are hidden sheets involved.</p>
  
  <p>Using Excel 2013 I open a new workbook.
  Add a Sheet after "Sheet1". Rename it "HiddenSheet2"
  Add a Sheet after "HiddenSheet2". Rename new sheet "Sheet3"
  So I have "Sheet1" - "HiddenSheet1" - "Sheet3"
  Then hide "HiddenSheet1"</p>
  
  <p>Next run this VBA Code:</p>
  
  <pre><code>Sub test()
  Dim ws1 AS Worksheet
  Set wst = Sheets("Sheet1")
  wst.Copy After:=Sheets(wst.Index)
  End Sub
  </code></pre>
  
  <p>The inserted sheet get placed after "HiddenSheet2" and not after "Sheet1".
  I found that the copied sheet becomes the active sheet. </p>
  
  <p><a href="https://stackoverflow.com/questions/1248822/get-handle-on-last-worksheet-copied-by-worksheet-copy?rq=1">Get Handle on last worksheet copied by Worksheet.Copy</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11990465/vba-copy-sheet-to-end-of-workbook-with-hidden-worksheets">VBA Copy Sheet to End of Workbook (with Hidden Worksheets)</a></p>
  
  <p>But my problem is I need the sheet to remain in a specific order.</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <pre><code>Sub test()
  Dim ws1 AS Worksheet
  Set wst = Sheets("Sheet1")
  wst.Copy After:=Sheets(wst.Index)
  ThisWorkbook.ActiveSheet.Move After:=Sheets(wst.Index)
  End Sub
  </code></pre>
  
  <p>This doesn't get the new sheet directly after "Sheet1" either.</p>