title: Delete sheets which DON'T have specific text in
body: <p>In Excel, I need to delete all sheets which don't end in (2)</p>
  
  <p>The following code corrently deletes those which DO end in (2), I'm just not sure how to reverse this, 'Not Like' doesn't seem to work</p>
  
  <pre><code>Dim ws As Worksheet
  
  For Each ws In ThisWorkbook.Sheets
      If ws.Name Like "*" &amp; "(2)" Then
          '~~&gt; This check is required to ensure that you don't get an error
          '~~&gt; if there is only one sheet left and it matches the delete criteria
          If ThisWorkbook.Sheets.Count = 1 Then
              MsgBox "There is only one sheet left and you cannot delete it"
          Else
              '~~&gt; This is required to supress the dialog box which excel shows
              Application.DisplayAlerts = False
              ws.delete
              Application.DisplayAlerts = True
          End If
      End If
  Next
  </code></pre>