macro to auto-veryhide

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Howdee all.
Hope everyone had a great weekend.
I'm looking to work through a series of workbooks that have numerous-- and I
mean lots-- of hidden tabs.
My goal is to xlveryhidden all hidden tabs, so that other users who don't
have the need can't access a hidden tab.

My initial thoughts on this have been-

if worksheet.visibility = xlhidden then
worksheet.visibility = xlveryhidden.

My problem is that when I've tried this, it'd hang up, or give me an error.
I'm sure that it's something real simple, but so far I haven't been able to
make it work.

And yes, I'd be using a for loop to work through all the hidden tabs in a
given file.

Thank you.
Best.
 
Sub makeverhidden()
For Each sh In Worksheets
If sh.Visible = False Then sh.Visible = xlVeryHidden
Next sh
End Sub
Sub unhidesheets()
For Each sh In Worksheets
sh.Visible = True
Next sh
End Sub
 
Steve said:
Never mind. I figured it out.
Gee... now wasn't that an easy one to answer? ;-)

Steve,

In the future, if you arrive at a solution before others have responded to
your thread, it would be helpful if you posted your solution so others who
have similar problems could benefit from it.

For this particular thread it is no longer necessary since Don has provided
a working solution.

Skiffle
 
Sorry 'bout that Skiff. I was working on multiple things last night and
forgot..... I normally do this, so here it is.

Sub VryHideShts()
'is macro is to very hide unwanted worksheets.
' HideSheet Macro

Dim sh As Worksheet
For Each sh In Worksheets
'sh.Select
If sh.Visible = 0 Then
sh.Visible = 2
'Else: MsgBox "No tabs to hide.", vbCritical, "Error"
End If
Next
End Sub
 
Hi Don.
Thanks for both the veryhide, and the unhide code. It'll definitely come in
handy.

Best.
 
Back
Top