How to delete hidden worksheets in Excel?
Do you have a workbook cluttered with hidden worksheets that are no longer useful and consume valuable space? Removing these unnecessary sheets can streamline your workbook. This guide will show you how to quickly and effectively delete all the hidden worksheets in Excel, helping you clean up and organize your data.
Delete hidden worksheets with VBA code
Delete hidden worksheets with Kutools for Excel
Delete hidden worksheets with the Inspect Document function
Delete hidden worksheets with VBA code
The following VBA code will delete all hidden worksheets within a workbook.
1. Open the workbook from which you want to delete hidden worksheets.
2. Click "Developer" > "Visual Basic" and a new "Microsoft Visual Basic for Applications window" will be displayed, click "Insert" > "Module", then copy and paste the following code into the Module:
Sub deletehidden()
'Updated by Extendoffice 2024/07/23
Dim a As Integer
a = 1
While a <= worksheets="" count="" span="">
If Not Worksheets(a).Visible Then
Worksheets(a).Delete
Else
a = a + 1
End If
Wend
End Sub
3. Click the button to execute the code, and a warning window will pop out for each hidden worksheet to make sure that you want to delete it. See screenshot:
4. Then click Delete. All hidden worksheets will now be deleted.
Delete hidden worksheets with Kutools for Excel
If you want to delete the hidden worksheets quickly, you can use Kutools for Excel.
After installing Kutools for Excel, you can do as follows:
1. Go to the ribbon, and click "Kutools Plus" > "Worksheet" > "Delete All Hidden Sheets", see screenshot:
2. Then a prompt box pops out to remind you if you want to delete all hidden worksheets. See screenshot:
3. Click Yes, and another prompt box will appear to remind you how many hidden worksheets have been deleted. See screenshot:
4. Click OK to finish this task.
Delete hidden worksheets with the Inspect Document function
You can use Excel's Inspect Document function to quickly and easily delete hidden worksheets.
1. Click "File" > "Info" > "Check for Issues" > "Inspect Document", see screenshot:
2. In the "Document Inspector" dialog box, click "Inspect" button.
3. The hidden worksheets will be identified during the inspection. Click the "Remove All" button to delete them from the active workbook.
Related article:
Delete all hidden rows or columns
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, 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!