Laughattack1834
New Member
- Joined
- Jun 16, 2017
- Messages
- 3
For my company, we have Excel pulling from our database to generate reports and it includes some sensitive information (Salary, PII). I want to make it so that when a person opens the shared Excel sheet they hit a button, it checks the username, and unhides sheet2 and sheet3, or only unhide sheet3 etc.
I have the whole setup created with the buttons and usernames but if I protect the sheet then nobody can unhide the sheet they need. It either has no security where anyone can unhide a sheet, or too much security that no one can unhide any sheet.
How can I not allow users to unhide a sheet, while using a macro button to unhide the sheets using their username permissions?
I have the whole setup created with the buttons and usernames but if I protect the sheet then nobody can unhide the sheet they need. It either has no security where anyone can unhide a sheet, or too much security that no one can unhide any sheet.
How can I not allow users to unhide a sheet, while using a macro button to unhide the sheets using their username permissions?
Code:
Sub Salary_Unlock()
Dim i As Long
For i = 1 To 10
If (Cells(i, 2) = Application.UserName) Then
Sheet8.Visible = xlSheetVisible
Exit For
Else
Sheet8.Visible = xlSheetVeryHidden
End If
Next i
End Sub