Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting unhidding worksheets 2

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
how exactly would i have a loop here i would just run through sheets that are not hidden, and then is there a simple command that says unhide all sheets? thanks!!
 
Hi,

each sheet has a Visible property
Code:
for each ws in worksheets
  with ws
    if .visible <> xlsheetvisible then
      .visible = xlsheetvisible
    end if
  end with
next
hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
There really isn't any need to see if the sheet is hidden or not if you want to unhide all of the sheets (and it makes your code shorter):
Code:
Sub UnhideAllWorksheets()
Dim ws As Worksheet
For Each ws In Worksheets
    ws.Visible =
Code:
True
Code:
Next ws
End Sub

ws.Visible = True is the same as ws.Visible = xlSheetVisible

ws.Visible = False is the same as ws.Visible = xlSheetHidden

The only .Visible property that can't be controlled like this is xlSheetVeryHidden.

I hope this helps!



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top