How to Delete/Remove Hidden Worksheets in Excel?

If there are some hidden worksheets exist in excel and you want delete them as they are not useful, you can unhide all worksheets and remove them one by one. This way is quite annoying and complex. If we can remove all hidden worksheets by only one step or a simple way, it will be much better. So, this article will help you to solve this issue. I will provide you two ways to remove all hidden worksheets conveniently. Please read the article below, let’s get started.

Delete/Remove Hidden Worksheets by VBA


Edit VBA script can help you to remove all worksheets in one workbook properly. So, this method is very helpful. You can copy below code directly.

Step 1: On current visible worksheet, right click on sheet name tab to load Sheet management menu. Select View Code, Microsoft Visual Basic for Applications window pops up.

Or you can enter Microsoft Visual Basic for Applications window via Developer->Visual Basic.

Step 2: In Microsoft Visual Basic for Applications window, click Insert->Module, enter below code in Module1:

Sub RemoveAllHiddenSheets()

Dim i As Integer

  Application.DisplayAlerts = False

  For Each sht In ActiveWorkbook.Sheets

      If sht.Visible = xlSheetHidden Then

        sht.Delete

        i = i + 1

      End If

  Next sht

  Application.DisplayAlerts = True

End Sub

Step 3: Save the codes, see screenshot below. And then quit Microsoft Visual Basic for Applications.

Delete Hidden Worksheets1

Step 4: Before run macro, let’s see if there are unhide worksheets exist in this workbook.

Delete Hidden Worksheets2

Unhide is enabled in menu so there are some hidden worksheets in this workbook.

Step 5: On current sheet, click Developer->Macro, in Macro window, select Macro ‘RemoveAllHiddenSheets’, then click Run.

Delete Hidden Worksheets3

Step 6: Check if the hidden worksheets are removed or not.

Delete Hidden Worksheets4

Unhide is disabled so there is no hidden worksheet now.

Comments:

  1. If you want to get some message when running macro to delete hidden worksheets, you can add below code into module. Then you can get some message prompts when executing the macro.
  If i = 1 Then

    MsgBox "[1] sheet is removed from this workbook."

  Else

    MsgBox "[" & i & "] sheets are removed from this workbook."

  End If
  1. See the screenshot below:

Delete Hidden Worksheets5

  1. Run macro this time, verify that below message pops up to indicate that some sheets are removed.

Delete Hidden Worksheets6

Delete/Remove Hidden Worksheets by Inspect Document Function


This method is helpful for the users who are not skilled in code editing. And they can follow below steps to remove all hidden worksheets. All operations are conveniently to operate.

Step 1: In Excel ribbon, click File->Info->Check for Issues->Inspect Document.

Delete Hidden Worksheets71

Step 2: Click Yes on pops up message.

Delete Hidden Worksheets8

Step 3: On pops up Document Inspector, click Inspect.

Delete Hidden Worksheets9

Step 4: On current Document Inspector window, drag the scrollbar to the end, verify that Hidden Worksheets is listed, click Remove All.

Delete Hidden Worksheets10

Step 5: Verify that all hidden worksheets were removed. Then click Close.

Delete Hidden Worksheets11

Step 6: Right click on sheet name tab to double check, verify that Unhide is disabled in menu, that means there is no hidden worksheet now.

Delete Hidden Worksheets12

 

Related Posts

VBA Macro For VLOOKUP From Another Sheet
vba macro for vlookup from another sheet1

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

How To Insert Comments in Protected Worksheet in Excel
insert commetns in protected workshee3

This post will show you how to allow comments in a protected worksheet in Excel. You can easily to insert comments into cells in a normal worksheet in Excel, but if want to insert a comment in a worksheet that ...

How To Convert Text to Upper Cases(Using VBA) in Excel
convert text to upper cases1

This post will show you how to switch from lower case to upper case in Excel. and I am going to show you two different ways of converting text to upper cases using formula or VBA macro in Excel 2013,Excel ...

How To Hide Every Other Row in Excel (Using VBA)
hide every other row1

This post will show you how to hide alternate rows or columns in Excel or how to hide every third, fourth, fifth row or column in Excel. If you want to hide every other row in your current worksheet, how ...

How to Disable the Save As Prompt in Excel
disable save as prompt1

This post will show you how to use a VBA Macro to save an Excel file and overwrite any existing file without a prompt so that you are going to get the little window that says file already exists do ...

How to Count Cells that Contain even or odd numbers in Excel
count cells that contain even numbers5

This post will guide you how to count the number of cells that contain odd or even numbers within a range of cells using a formula in Excel 2013/2016.How do I count cells that contain odd numbers through the use ...

How to Count Cells that Contain negative Numbers in Excel

This post will guide you how to count the number of cells that contain negative numbers within a range of cells using a formula in Excel 2013/2016.You can count the number of negative numbers in your data using easy functions ...

How to Count Cells Are Not Blank or Empty in Excel
count non blank nonempty cells5

This post will guide you how to count cells that are not blank or empty in a given range cells using a formula in Excel 2013/2016.How do I count the number of cells that are not blank in a particular ...

How to Count Cells Less Than a Specific Value in Excel
count cells lessr than5

This post will guide you how to count the number of cells less than a particular numeric value in a given range cells using a formula in Excel 2013/2016. How do I count cells that are less than a specific ...

How to Count Cells Greater Than a Specific Value in Excel
count cells greater than 5

This post will guide you how to count the number of cells greater than a particular numeric value in a given range cells using a formula in Excel 2013/2016. How do I count cells that are greater than a specific ...

Sidebar