Unhide Sheet Passwords

Peter.S

New Member
Joined
May 25, 2011
Messages
1
I have a workbook that has approx 20 sheets, all sheets except Sheet 1 are veryhidden and can only become visible with a macro that is assigned to a button on sheet1 (each sheet has its own button) a password is required when the button is clicked. Currently I have to enter VBA to change the passwords - I am passing the documnet on to an administrator who I don't want too enter the VBA -

I would Ideally like to create a new sheet 'Administrator' which would be hidden and accessed by a password. to change the passwords all the administrator would need to do would be change the contents of the cells A1-A20; so Sheet 2 Password would be what is in Cell A1 ect...


this is the code I am using at the moment

Option Explicit

Option Compare Text
'Password to unhide sheets
Const pWord = "password"

Sub HideBusiness1()
'Set worksheet to Very Hidden so that it can only be unhidden by a macro
Worksheets("Business1").Visible = xlSheetVeryHidden
Sheets("PDR Home").Select
End Sub
Sub ShowBusiness1()
'Prompt the user for a password and unhide the worksheet if correct
Select Case InputBox("Please enter the password to unhide the sheet", _
"Enter Password")

Case Is = pWord
With Worksheets("Business1")
.Visible = xlSheetVisible
.Activate
.Range("A1").Select
End With
Case Else
MsgBox "Sorry, that password is incorrect!", _
vbCritical + vbOKOnly, "You are not authorized!"
End Select
End Sub

Would appreciate any help
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top