Monday, November 01, 2004

VBA code to Unhide Sheets in Excel

I often hide sheets in Excel. This hides them from prying eyes (and fiddling fingers), and in the case of an Excel Workbook that is protected they are also unable to be unhidden.

Often however I will need to work on the hidden sheets. The manual process in Excel for this is to click Format - Sheet - Unhide from the menu. This will bring up a dialog box of the hidden sheets. You can select one sheet and unhide it. This becomes painful if you have a number of sheets to unhide.

Here is the code I use that will unhide them all rapidly.

Sub unhide_sheets()
'Macro written by Jethro Management
For Each ws In Sheets
ws.Visible = True
Next ws
End Sub

Simply copy and paste into an Excel VBA module and run it to unhide all sheets in an Excel Workbook.