Subscribe for Weekly Tutorials
BONUS: subscribe now to download our Top Tutorials Ebook!
Delete Hidden Worksheets
Where to install the macro: Module
Delete Hidden Worksheets
Sub DeleteHiddenWorksheets()
'This Macro will remove all hidden worksheets from a workbook.
'There will be a warning window that pops up to make sure you want
'to do this just in case there is other information that is needed
'within those hidden sheets.
i = 1
While i <= Worksheets.Count
If Not Worksheets(i).Visible Then
Worksheets(i).Delete
Else
i = i + 1
End If
Wend
End Sub
Subscribe for Weekly Tutorials
BONUS: subscribe now to download our Top Tutorials Ebook!
Similar Content on TeachExcel
Delete Hidden Rows in a Workbook
Macro: This macro will delete hidden rows from every worksheet in an entire workbook. However...
Macro: This macro will delete hidden rows from every worksheet in an entire workbook. However...
Delete All Chart Sheets in Excel - Only Chart Sheets are Deleted - Not Embedded Charts
Macro: Delete all chart sheets and tabs in Excel using this macro. This will only delete the char...
Macro: Delete all chart sheets and tabs in Excel using this macro. This will only delete the char...
Hide Data Within a Worksheet in Excel
Tutorial: In Excel you can actually hide data that is stored within a worksheet. This allows you to ...
Tutorial: In Excel you can actually hide data that is stored within a worksheet. This allows you to ...
Hide Formulas in a Worksheet and Prevent Deletion
Macro: This macro will hide all formulas within a workbook and not allow them to be deleted. The ...
Macro: This macro will hide all formulas within a workbook and not allow them to be deleted. The ...
Automatically Copy New Data to Another Worksheet
: This macro allows you to quickly and easily copy all new data from one worksheet to anoth...
: This macro allows you to quickly and easily copy all new data from one worksheet to anoth...
Apply Worksheet Changes to All Worksheets in Excel
Tutorial: Quickly copy all or parts of a single worksheet - data, formatting, or both - to multiple ...
Tutorial: Quickly copy all or parts of a single worksheet - data, formatting, or both - to multiple ...
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.