Please see the attached.
The code goes into the ThisWorkbook module. This is because we want this code to run when the workbook is opened.
I created a sheet called "UserList". This sheet has two columns, Username and "View All". Enter the username in column A (exactness is important), then TRUE or FALSE in "View All". You really only need to add users that will view all. So, TRUE will only ever need to be entered in column B. If the user is not in the list, then they cannot see the calculation sheet anyway. Since only one value is expected in col B, we could even eliminate this column and just search col A for a match. I chose not to do this for you because I wanted to show that you could have multiple permission options. Just add a column, add a test in your code, and you are all set.
If you will only ever need this one permission, then simply delete column b in Userlist and modify your code to this:
I also hid the Calculation and Userlist sheets. This is so that they will remain hidden if the user is not found in the list or if they do not enable macros.
Bookmarks