need help, want to remove some sheets

  • Thread starter Thread starter Newbie80
  • Start date Start date
N

Newbie80

Hi, I have some sheets that starts with the same substring and I wan
all of them to be removed is there a simpel solution to this?

e.g
Thisworkbook.sheets("name-yyyy").delete exact match
The year differs so would like to remove all sheets that starts with:
Thisworkbook.sheets("name-").delete (multi delete if poss
 
For Each sh In ThisWorkbook.Worksheets
If Left(sh.Name,5) = "name-" Then
if ThisWorkbook.Sheets.Count <> 0 Then
Application.DisplayAlerts = false
sh.delete
Application.DisplayAlerts = True
End If
End If
Next sh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top