Hi,
Question: I have one excel workbook (2003) that is accessed by three people. I'd like each person to have a different password to the same sheet.
For example, person 1 can update columns A-D, person 2 can update columns E-G and person 3 can update columns H-J. Is it possible to have three passwords on the same spreadsheet?
Thank you!
Rachel
This would require VBA. I'm just beginning to learn VBA but here's what I came up with. You will need to secure your VBA code to prevent people from looking at the code where other people's passwords will be seen. One of the VBA gurus here might improve on this code. You''ll need a subroutine that runs on opening the workbook (to unprotect specific columns) and one to work on saving (to reprotect those columns). These routines should be pasted in "Thisworkbook". Right click on a tab and "view code" to open the vba editor and then double click on thisworkbook to open that code window. In my example, I did not protect the code so you can view it.
I chose Jim, Lynn, and Bob with passwords JimsPassword, LynnsPassword and BobsPassword. The sheet password is "test_one"
Routine 1Routine 2 (for saving) much shorter.Code:Private Sub Workbook_Open() Dim UserName As String Dim Pword As String Dim Qualifier As String Sheets("Sheet1").Select Application.ScreenUpdating = False UserName = InputBox("Enter your name") Qualifier = InputBox("Enter your password") Select Case UserName Case "Jim" If Qualifier = "JimsPassword" Then 'Replace with Jim's log in password ActiveSheet.Unprotect Password:="test_one" 'Replace with the worksheet password Columns("A:B").Select Selection.Locked = False [A1].Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="test_one" 'Replace with the worksheet password Else MsgBox ("That is the incorrect password. Close the book and try again") End If Case "Lynn" If Qualifier = "LynnsPassword" Then 'Replace with Lynn's log in password ActiveSheet.Unprotect Password:="test_one" 'Replace with the worksheet password Columns("C:D").Select Selection.Locked = False [A1].Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="test_one" Else MsgBox ("That is the incorrect password. Close the book and try again") End If Case "Bob" If Qualifier = "BobsPassword" Then 'Replace with Bob's log in password ActiveSheet.Unprotect Password:="test_one" Columns("E:F").Select Selection.Locked = False [A1].Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="test_one" Else MsgBox ("That is the incorrect password. Close the book and try again") End If Case Else MsgBox ("You have view only rights to this spreadsheet") End Select Application.ScreenUpdating = True End SubCode:Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) ActiveSheet.Unprotect Password:="test_one" Columns("A:F").Select Selection.Locked = True [A1].Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="test_one" End Sub
ChemistB
My 2¢
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
Good evening Rachel Thomas
...and welcome to the forum!!
You can do this without resorting to VBA by using Tools > Protection > Allow users to edit ranges.
You use this facility to define ranges and secure it with a password. You will need to define user A's ranges, with a password, and user B's ranges with another password, and so on. Then invoke protection (Tools > Protect Sheet, without a password) and the users will not be able to edit each others' ranges (unless they have the other password).
Don't forget the passwords.
HTH
DominicB
Now available : Ultimate Add-In 2007
Integrates directly into the Office Excel Ribbon
Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
90+ Utilities, 200+ Sub utilities last updated 25th April 2008
Free!!
:::slapping forehead::: Going from Excel 2000 directly to 2007, I forgot that 2003 had that capability. My bad.
ChemistB
My 2¢
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
You know ChemistB, that really is no excuse. You gave me my 5th ever rep point for this post, back in July last year ...
Take care.
DominicB
Now available : Ultimate Add-In 2007
Integrates directly into the Office Excel Ribbon
Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
90+ Utilities, 200+ Sub utilities last updated 25th April 2008
Free!!
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks