ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to auto-veryhide (https://www.excelbanter.com/excel-programming/438300-macro-auto-veryhide.html)

Steve

macro to auto-veryhide
 
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.

Steve

never mind- I got it.
 
Never mind. I figured it out.
Gee... now wasn't that an easy one to answer? ;-)


Don Guillett

macro to auto-veryhide
 
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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Steve" wrote in message
...
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.



Skiffle

never mind- I got it.
 
"Steve" wrote in message
...
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


Steve

never mind- I got it.
 
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

Steve

macro to auto-veryhide
 
Hi Don.
Thanks for both the veryhide, and the unhide code. It'll definitely come in
handy.

Best.


"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Steve" wrote in message
...
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.


.



All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com