Unhiding WorkSheets

DGB

Board Regular
Joined
Oct 17, 2007
Messages
134
Hi,


I have a macro which, based on certain criteria, hides certain workshheets using the VBA property xlSheetVeryHidden. Excel does not reognize the Unhide command to re-display the sheets when this property is used.

Does anyone know how to write a macro that would unhide the Hidden sheets?

Thanks in advance for your help.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Thank you Yard

So if the critera for hiding the cell is A2>0, what would the code look like to scan all sheets in the workbook and unhide those previously hidden?
 
Upvote 0
Huh? Do you mean:

If the cell value of A2 in any sheet is >0 then unhide that sheet, otherwise hide it?

Code:
Sub ShowHide()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    If ws.Range("A2") > 0 Then
        ws.Visible = xlSheetVisible
    Else
        ws.Visible = xlSheetVeryHidden
    End If
Next ws
End Sub
 
Upvote 0
Hi yard,

Thank you for helping me. Unfortunately I can not seem to get this to work. Below is the macro with which I am coloring the tab of sheets where cell A2>0, printing them and hiding the others. What I would like is to reverse all of these actions. (Uncolor and Unhide all tabs. I understand I can not reverse a print). I cannot seem to get your macro to apply to sheets or tabs already hidden.

What am I doing wrong?

Dim ws As Worksheet

For Each ws In Worksheets
With ws
If .Range("a2").Value > 0 Then
.Tab.ColorIndex = 10
.PrintOut
Else: ws.Visible = xlSheetVeryHidden
End If
End With
Next ws
Sheets("QuoteSummary").Select
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top