unhide sheet macro

O

Owen

I have some files with many hidden sheets. How do I
unhide ALL of the hidden sheets using the fewest steps?

I would think that I could select multiple sheets to
unhide but I can't. Instead, I have to manually go to the
menu and select: Format, Sheet, Unhide, select a sheet
name, OK; and do this over and over again.

Is there a macro that I can create so that it looks for a
hidden sheet (not a specifically named sheet as the names
vary from file to file), unhide it, then look for the next
hidden sheet and so on until all sheets are unhidden.

Hope there's an answer out there. Thanks.
 
D

Debra Dalgleish

The following macros will hide and unhide all the sheets in the
workbook. When hiding sheets, the last sheet will remain visible.

'=========================
Sub UnhideSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
End Sub
'==========================
Sub HideSheets()
On Error Resume Next
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetHidden
Next ws
End Sub
'===================
 
G

Gord Dibben

Owen

Sub Show_Sheets()
Dim I As Integer
For I = 1 To ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(I).Visible = True
Next I
End Sub

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top