|
Question : Excel: restrict certain fields for particular person. Make new top of page for each Division.
|
|
We have a spreadsheet containing data that will be updated by five managers at various times. The file has been saved on a common drive for their use. The data file is divided into five sections. The head boss will keep tabs on the update. The program now calculates as expected with totals, subtotals and grandtotals. The file is protected. The rows that need to be updated are not protected. All formulas work properly.
1. Is their a way where certain cells or columns can be restricted for use by only one person? I have set these special fields to have a light yellow background to remind the other managers to not input data or delete data in these fields. Ideally, they would be locked to everyone but this accountant. I know how to lock the fields. It's the same way that I have locked formulas and titles. The unlocked fields include these special fields.
Is there a way that the special user may enter a password "one time" and the program will allow them to update these fields? Is there a way that the special fields can be locked and unlocked by password?
2. Is there a way to tell the computer to automatically go to a new top of page when the Division changes. This is the way that reports can be made for each of the divisions. One of more pages will be printed for each Division and show the totals for that Division.
Thanks for any assistance you can give.
WS
|
|
Answer : Excel: restrict certain fields for particular person. Make new top of page for each Division.
|
|
Hi sherman6789, It may be more trouble than you think it is worth, but you might consider locking all the ranges when the file is opened, but unlock specific ranges depending on the user using a macro. This macro would ask for a password, or possibly base all the unlocking on the Windows log-in name.
Sub Workbook_Open() Dim myPassword As String, sUser As String Dim vProtect As Variant, v As Variant myPassword = "sherman6789" sUser = Environ("UserName") 'sUser=inputbox("Please enter your password.") 'Alternate method using a password vProtect = Array("A10:Z20", "A40:Z50", "A70:Z80", "A100:Z110", "A130:Z140") 'Lock these ranges for "wrong" user With Worksheets("Sheet2") .Unprotect Password:=myPassword For Each v In vProtect 'Lock all the ranges .Range(CStr(v)).Locked = True Next Select Case LCase(sUser) Case "byundt" .Range("A10:Z20").Locked = False Case "tjones" .Range("A40:Z50").Locked = False Case "wsherman" .Range("A70:Z80").Locked = False Case "asmith" .Range("A100:Z110").Locked = False Case "hmisanthrope" .Range("A130:Z140").Locked = False End Select .Protect Password:=myPassword End With End Sub
To install a sub in the code pane for ThisWorkbook: 1) ALT + F11 to open the VBA Editor 2) If you don't see a list of VBA projects on the left, then CTRL + R to open the Project Explorer 3) In the Project Explorer window, double-click ThisWorkbook to open its code pane 4) Paste the suggested code in the resulting module sheet 5) ALT + F11 to return to the spreadsheet
Hoping to be helpful,
Brad
|
|
|
|