Delete all worksheet
VBA

Delete all blank worksheet using Personal Macro

In this article, we have create the a Personal Macro to delete all blank worksheet from active workbook. You can use this for the workbook wherein you have multiple worksheet and you want to delete the blank worksheet only. You can add a button on your excel ribbon to delete all blank worksheet from active workbook.

You can add below given code in your personal macro.

Option Explicit

Sub Delete_Blank_Worksheets()

Application.DisplayAlerts = False

Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets
   If Application.WorksheetFunction.CountA(sh.Cells) = 0 Then
      If ActiveWorkbook.Worksheets.Count > 1 Then
         sh.Delete
      End If
   End If
Next

MsgBox "Done"

End Sub

Watch the step by step video tutorial:

Click here to download this practice file.

PK
My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 10 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.
https://www.pk-anexcelexpert.com