title: Delete sheets after certain sheet
body: <p>I need to delete all sheets after a sheet called "template 1".</p>
  
  <p>So far I have tried </p>
  
  <pre><code>Sub SheetKiller()
      Dim i As Long
      Dim j As Long
      j = 0
      For i = 1 To Sheets.Count
          If Sheets(i).Name = "template 1" Then
              j = i
          End If
      Next i
  
      If j = 0 Or j = Sheets.Count Then Exit Sub
  
      Application.DisplayAlerts = False
          For i = Sheets.Count To j + 1 Step -1
              Sheets(i).Delete
          Next i
      Application.DisplayAlerts = True 
  End Sub
  </code></pre>
  
  <p>However, I get the error message "Delete method of Worksheet class failed". Anyone got a solution to this?</p>