Sub DeleteBlankSheets()Dim sh As VariantApplication.ScreenUpdating = FalseApplication.DisplayAlerts = FalseOn Error GoTo Exits:For Each sh In Sheets'IsChart checks, if sh is a Chart Object or some other object.If Not IsChart(sh) Then
'CountA checks if there is any data in cells of the sheetIf Application.WorksheetFunction.CountA(sh.Cells) = 0 Then sh.DeleteEnd IfNext shExits:Application.ScreenUpdating = TrueApplication.DisplayAlerts = TrueEnd SubFunction IsChart As BooleanDim tmpChart As ChartOn Error Resume NextSet tmpChart = Charts(sh.Name)IsChart = IIf(tmpChart Is Nothing, False, True)End Function

Nenhum comentário:
Postar um comentário