need help, want to remove some sheets

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
 
B

Bob Phillips

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
 
Top