Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to remove empty sheets from a workbooks

Supposing you have a large workbook with multiple sheets, but there are some empty sheets without any contents in this workbook. To make the workbook more professional and formal, you want to remove these blank sheets from the workbook. Instead of removing the empty sheets one by one, I introduce the methods to remove all blank sheets quickly.

Remove blank sheets by VBA

Remove blank sheets by Kutools for Excel good idea3


arrow blue right bubble Remove blank sheets by VBA


Here I introduce a VBA to help you quickly remove all blank sheets from an opened workbook.

1. Press Alt + F11 keys to enable Microsoft Visual for Basic Applications window.

2. And click Insert > Module, paste below VBA code to the new popped out Module window.

VBA: Remove empty sheets.

Sub DeletEmptySheets()
'UpdatebyKutoolsforExcel20151130
    Dim xWs As Worksheet
    Dim xAlert As Boolean
    Dim xCount As Long
    xAlert = Application.DisplayAlerts
    Application.DisplayAlerts = False
    If MsgBox("Are you sure to remove all empty sheets?", vbYesNo, "Kutools for Excel") = vbNo Then Exit Sub
    For Each xWs In ActiveWorkbook.Worksheets
        If (Application.CountA(xWs.Cells) = 0) And _
           (xWs.Shapes.Count = 0) Then
            xWs.Delete
            xCount = xCount + 1
        End If
    Next
    MsgBox "You have removed " & xCount & " empty sheet(s)", , "Kutools for Excel"
    Application.DisplayAlerts = xAlert
End Sub

 

3. And press F5 key or Run button to execute the VBA, and a dialog pops out to remind you whether to remove empty sheets, click Yes to go on removing, No to cancel this VBA.

doc remove empty sheets 1

4. After clicking Yes, a dialog pops out to tell you the number of removed sheets, click OK to close it, and all the empty sheets have been removed at this moment.

doc remove empty sheets 2

formula Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group
as auto text, and liberate your brain!       Know About Auto Text     Get Free Trial

arrow blue right bubble Remove blank sheets by Kutools for Excel

For some Excel green hands, the VBA is a somewhat difficult method to execute, but with Kutools for Excel’s Delete Blank Worksheets function, you can quickly remove all empty sheets from a workbook with three mouse-clicks!

Kutools for Excel, with more than 120 handy Excel functions, enhance your working efficiency and save your working time.

After free installing Kutools for Excel, please do as below:

1. Enable the workbook you want to remove its empty sheets, and click Enterprise > Worksheet > Delete Blank Worksheets. See screenshot:

doc remove empty sheets 3

2. And a Kutools for Excel dialog pops out to reconfirm that if you want to remove all blank sheets, and click Yes to continue removing, and No to cancel. See screenshot:

doc remove empty sheets 4

3. And after clicking Yes, a dialog pops out to remind you the number of successfully removed sheets. Click OK to close it.

doc remove empty sheets 5

pay attention1If you are interested in this addi-in, click here to download the 60-days free trial.


Relative Articles:


doc KTE



Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.