Howdy! Is there a way to have an Excel workbook with several sheets in it open differently for different users? I have some sheets I only want the nurse administrators to see, and some sheets that all the nurses can see, and one sheet only I can see... is there a way to set up a password that would be based on these three different criteria? I've not worked much with passwords and Excel before.
Thanks
MishMish
For example--see attached:
Workbook title: "Perinatal Hep B Data 2010"
Tab1 is "PNHB_Monthly_Data", which can be seen by everyone--nurses, nurse administrators, and me.
Tab2 is "Monthly_TTLS" which can be seen by the nurse administrators and me.
Tab3 is "Data_Crunching" which can only be seen by me.
password protect workbook based on user level?
-
- PlatinumLounger
- Posts: 3691
- Joined: 15 Jul 2010, 14:10
- Location: Milton, TN
password protect workbook based on user level?
You do not have the required permissions to view the files attached to this post.
Anne
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: password protect workbook based on user level?
The attached workbook (.xlsm format) shows a rather primitive way of doing it.
The last two sheets are hidden, and they can't be unhidden by the usual means.
I have added a "Start" sheet with three buttons to activate each of the other sheets.
You'll have to provide a password for the last two sheets.
To prevent users from looking at the VBA code, the VBA project has been password-protected too.
In this example, the passwords are listed on the Start sheet. You'd remove them in a "real" version of course.
Note: users need to enable macros in order to be able to click the buttons, for example by placing the workbook in a trusted location. If macros are disabled, there is no way to unhide the last two sheets.
The last two sheets are hidden, and they can't be unhidden by the usual means.
I have added a "Start" sheet with three buttons to activate each of the other sheets.
You'll have to provide a password for the last two sheets.
To prevent users from looking at the VBA code, the VBA project has been password-protected too.
In this example, the passwords are listed on the Start sheet. You'd remove them in a "real" version of course.
Note: users need to enable macros in order to be able to click the buttons, for example by placing the workbook in a trusted location. If macros are disabled, there is no way to unhide the last two sheets.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: password protect workbook based on user level?
Hi Hans
Can you advise of any drawback to writing the first procedure of the project you provided, to the code shown below?
Can you advise of any drawback to writing the first procedure of the project you provided, to the code shown below?
Code: Select all
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Workbook_Open
End Sub
Regards
Don
Don
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: password protect workbook based on user level?
None. You could also create a separate procedure, either in ThisWorkbook or in a standard module:
and call it from both Workbook_BeforeSave and Workbook_Open:
Code: Select all
Sub SetStart()
Worksheets("Start").Select
Worksheets("Monthly_TTLS").Visible = xlSheetVeryHidden
Worksheets("Data_Crunching").Visible = xlSheetVeryHidden
End Sub
Code: Select all
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Call SetStart
End Sub
Private Sub Workbook_Open()
Call SetStart
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
-
- 3StarLounger
- Posts: 233
- Joined: 10 Feb 2010, 19:17
Re: password protect workbook based on user level?
Don,
If there are not too many users involded, you could unhide sheets based on the login. The problem with this method is that maint could be a killer if there are changes to the list of users regularly. The benefit is that the user would not have to remember a password.
If there are not too many users involded, you could unhide sheets based on the login. The problem with this method is that maint could be a killer if there are changes to the list of users regularly. The benefit is that the user would not have to remember a password.
Chuck Reimer
(I'm from the Government and I'm here to help) ;-)
(I'm from the Government and I'm here to help) ;-)