derek.hughes
Board Regular
- Joined
- Mar 16, 2012
- Messages
- 53
I made a spreadsheet with employee leave balances. There is a "HomePage" worksheet with instructions, and each supervisor also has their own worksheet with their direct reports listed.
I added a VB script to each worksheet to password protect them and gave each supervisor a password. This prevents them from seeing each others' employees leave balances.
The problem is, if a person clicks and holds on the worksheet tab they can see everything contained on the sheet before releasing and receiving the password prompt - not good.
I would like to rework the spreadsheet so all the data sheets are hidden except for the "HomePage" worksheet, and I would like that "HomePage" to contain macro buttons with each supervisor's name. When the button is clicked I want a prompt to appear requesting a unique password, and if the correct password is entered I want the appropriate supervisor's sheet to unhide. If the incorrect password is entered I want it to error back to the "HomePage" worksheet. Do you know a way to do this?
Here is the current script I am working with, and thank you for your time.
Private Sub Worksheet_Activate()
ActiveWindow.WindowState = xlMinimized
If InputBox("Enter Password for this sheet") <> "HRadmin" Then Sheets("HomePage").Activate
ActiveWindow.WindowState = xlMaximized
End Sub
I added a VB script to each worksheet to password protect them and gave each supervisor a password. This prevents them from seeing each others' employees leave balances.
The problem is, if a person clicks and holds on the worksheet tab they can see everything contained on the sheet before releasing and receiving the password prompt - not good.
I would like to rework the spreadsheet so all the data sheets are hidden except for the "HomePage" worksheet, and I would like that "HomePage" to contain macro buttons with each supervisor's name. When the button is clicked I want a prompt to appear requesting a unique password, and if the correct password is entered I want the appropriate supervisor's sheet to unhide. If the incorrect password is entered I want it to error back to the "HomePage" worksheet. Do you know a way to do this?
Here is the current script I am working with, and thank you for your time.
Private Sub Worksheet_Activate()
ActiveWindow.WindowState = xlMinimized
If InputBox("Enter Password for this sheet") <> "HRadmin" Then Sheets("HomePage").Activate
ActiveWindow.WindowState = xlMaximized
End Sub