I am looking for a VBA macro that can delete all the sheets in Excel the start with name "Sheet".
Also if no such sheet name is found it should give a simple msg box saying No sheet found. And if delete is successful it should say Sheets deleted.
Sub test()
Dim j As Integer, k As Integer
Application.DisplayAlerts = False
j = Worksheets.Count
For k = 1 To j
If Worksheets(k).Name = "sheet" Then
Worksheets(k).Delete
GoTo line1
End If
Next k
line1:
Application.DisplayAlerts = True
End Sub