#1   Report Post  
ditchy
 
Posts: n/a
Default macro to hide sheets

Hello there,
would anyone be able to help me with this please.
I have a workbook with 100+ sheets and I need to hide all but two
until a password is entered, then the rest of the sheets can be viewed.
All help is appreciated
Thanks, Ditchy

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

The password routine is simple and not robuts, but may suit your purpose

Sub HideSheets
For Each sh In Activeworkbook.Worksheets
If sh.Name < "some name" And sh.Name < "some other name" Then
sh.Visible = xlSheetHidden
End If
Next sh
End Sub

Sub ShowSheets
Dim sPass
sPass = Inputbox ("Supply password")
If sPass = "abc" Then
For Each sh In Activeworkbook.Worksheets
sh.Visible = xlSheetHidden
Next sh
End If
End Sub

--
HTH

Bob Phillips

"ditchy" wrote in message
ups.com...
Hello there,
would anyone be able to help me with this please.
I have a workbook with 100+ sheets and I need to hide all but two
until a password is entered, then the rest of the sheets can be viewed.
All help is appreciated
Thanks, Ditchy



  #3   Report Post  
ditchy
 
Posts: n/a
Default

Thanks for that info Bob,
what I really need is when all the sheets are hidden except for the (3)
I wan't left on view, they can be viewed. If there is a password given
the rest of the hidden sheets become visable.
thanks again
Ditchy

  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Isn't that what I gave?

--
HTH

Bob Phillips

"ditchy" wrote in message
ps.com...
Thanks for that info Bob,
what I really need is when all the sheets are hidden except for the (3)
I wan't left on view, they can be viewed. If there is a password given
the rest of the hidden sheets become visable.
thanks again
Ditchy



  #5   Report Post  
ditchy
 
Posts: n/a
Default

Hi there Bob
looking at your answer again yes it is, my problem is I have over 100
sheets and I was hoping not to have to name them all for your macro, is
there another way around it. Say name the 3 I want on view, hide the
rest and to access the hidden only by password. If no password given
still be able to veiw/edit the original 3 on view.
Thank you for your patience
regards
Ditchy

Bob Phillips wrote:
Isn't that what I gave?

--
HTH

Bob Phillips



"ditchy" wrote in message
ps.com...
Thanks for that info Bob,
what I really need is when all the sheets are hidden except for the

(3)
I wan't left on view, they can be viewed. If there is a password

given
the rest of the hidden sheets become visable.
thanks again
Ditchy




  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

I still think it is doing what you want, albeit with 2 names not 3.

It will hide all but those two, and will unhide hidden sheets when a
password is given.

--
HTH

Bob Phillips

"ditchy" wrote in message
oups.com...
Hi there Bob
looking at your answer again yes it is, my problem is I have over 100
sheets and I was hoping not to have to name them all for your macro, is
there another way around it. Say name the 3 I want on view, hide the
rest and to access the hidden only by password. If no password given
still be able to veiw/edit the original 3 on view.
Thank you for your patience
regards
Ditchy

Bob Phillips wrote:
Isn't that what I gave?

--
HTH

Bob Phillips



"ditchy" wrote in message
ps.com...
Thanks for that info Bob,
what I really need is when all the sheets are hidden except for the

(3)
I wan't left on view, they can be viewed. If there is a password

given
the rest of the hidden sheets become visable.
thanks again
Ditchy




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Enable/Disable Macro pop-up when file opens steve Excel Worksheet Functions 3 April 12th 05 04:50 PM
macro to hide rows david Excel Discussion (Misc queries) 3 April 8th 05 03:25 PM
Sheets Skip Macro NICK Excel Discussion (Misc queries) 2 February 11th 05 07:16 AM
Macro for moving sheets minhao Excel Discussion (Misc queries) 3 December 10th 04 08:09 AM
Macro to hide rows with empty cells tp58tp Excel Worksheet Functions 2 November 13th 04 02:01 PM


All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"