HI,
I have created the below macro to do this but it does not run through the whole workbook, I keep having to re-run the macro to delete other sheets (Some workbooks conatin 6-7 worksheets that end in Cube or Chart) Also If I could get it to stop asking me before deleting the worksheets and just delete them that would be great.
Sub delete_Cube_Chart_Tree()
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 4) = "Cube" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 5) = "Chart" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 4) = "Tree" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
End Sub
I have created the below macro to do this but it does not run through the whole workbook, I keep having to re-run the macro to delete other sheets (Some workbooks conatin 6-7 worksheets that end in Cube or Chart) Also If I could get it to stop asking me before deleting the worksheets and just delete them that would be great.
Sub delete_Cube_Chart_Tree()
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 4) = "Cube" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 5) = "Chart" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
For Each SheetExists In Worksheets
If Right(SheetExists.Name, 4) = "Tree" Then
SheetExists.Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
End Sub