Click event unhiding sheet

  • Thread starter Thread starter gavmer
  • Start date Start date
G

gavmer

Hi all,

I have a protected workbook/worksheet that is hidden. I would like t
create a click event that prompts the user for a password and the
unhides the sheet. Note: the sheet to be unhidden is protected.

In a perfect world, i would hope for a click event on the unhidde
sheet that reverses the process.........hides the sheet with th
password.

Any ideas????????


Cheers all!!!!
 
First of all, you do not want the sheet hidden, you want it "ver
hidden". Otherwise, the user can defeat your password protectio
pretty easily by using the Format > Sheet > Unhide button (or a host o
other simple tricks that force a hidden sheet to reveal itself).

Setting the visible property to "very hidden" can not be done fro
Excel, it can only be done from VBA.

Here are two subroutines that. One will hide the sheet if the passwor
given is "Goodbye". The other will unhide the sheet if the passwor
given is "Hello".

Sub HideSheet()

myPassword = InputBox("Enter Password")
If myPassword = "Goodbye" Then Sheets("Sheet2").Visible
xlSheetVeryHidden

End Sub

Sub UnHideSheet()

myPassword = InputBox("Enter Password")
If myPassword = "Hello" Then Sheets("Sheet2").Visible
xlSheetVisible

End Su
 
Hi there,

Thanks for the reply. How do i assign a click event to each functio
(hide and unhide) on 'sheet1'??

Cheers!!
 
gavmer

You can do 2 ways, First you can create buttons by selecting the Vie
toolbar forms and select the command button or you can select view
toolbar and control toolbox and select the command button. Wit the
first option you can right click and asign a macro. The proceedures yo
were given has to be on the sheet you want the buttons on. Right clic
the tab and select view code. Paste the macros to that module. With th
second option command button from the toolbox. Double click the butto
and post on of the codes to that module. You add a second button and d
the same thing.

HTH

Charle
 
Hi charles,

Spot on!!! Thank you!

Is there a way to have the font hidden or ****** when keying in. I onl
ask as it is visible when keying.

Thanks!!!
 
Back
Top