I have a workbook that is used every year that changes every year for example one year the worksheets are Jan 1, Jan 15, Jan 29, Feb 12 and so on, next year it has worksheets that are Jan 2, Jan 16, Jan 30, Feb 13 and so on. Well every year at the end of every year I need to delete those worksheets and then replicate the new worksheets from the template worksheet. So as you can tell the names of the worksheets change every year and I would like to delete the worksheets all at once and not leave room for errors. So I recorded a vba script but I cannot find a way to just delete all the worksheets that are Jan*, Feb*, Mar*, Apr* and so on. Below is an example of what I have but does not work.
Sub Macro1()
'
' Macro1 Macro
'
Sheets(Array("Jan 16", "Jan 30", "Feb 13", "Feb 27", "Mar 12", "Mar 26", "Apr 9", _
"Apr 23", "May 7", "May 21", "Jun 4", "Jun 18", "Jul 2", "Jul 16", "Jul 30", "Aug 13", _
"Aug 27", "Sep 10", "Sep 24", "Oct 8", "Oct 22", "Nov 5", "Nov 19", "Dec 3", "Dec 31")) _
.Select
Sheets("Dec 31").Activate
Sheets("Dec 17").Select Replace:=False
ActiveWindow.SelectedSheets.Delete
End Sub
While Sheets.Count > 0 delete Sheets[0]
should work. – Ken White