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
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: