Unanswered: Deleting worksheets from a workbook with VBA
I am having problems deleting worksheets from a workbook with this VBA:
What I want to do is to remove any sheets that have the default name. There are always sheets in the book, so it is not as if I am trying to remove the last one, but it always leaves one sheet in the workbook with a name beginning "sheet".
For iSort = 1 To wbkCharts.Worksheets.Count
If LCase(Left(wbkCharts.Sheets(iSort).Name, 5)) = "sheet" Then
Application.DisplayAlerts = False
Application.DisplayAlerts = True
It is usually the last but one sheet, and I get no errors or warnings. I have tried adding code to activate the first sheet each time the code loops to ensure that the sheet I am trying to delete is not activated, but the problem will not go away.
Does anyone know what is going on?
Make something idiot proof and someone will make a better idiot...