There are certain things I want my worksheet to be able to do that just do not seem to function very well when I lock it. On the flip side, I need to be able to control who is able to modify what. In the past, that meant locking it, and incorporating password protected "unlock/lock" buttons. This is not practical anymore.
How can I set a worksheet so that:
1. User with windows login "abc" can click on and modify anything
2. User with windows login "def" can click on and modify anything
3. All other users [wild card?] can only click on macros with specific names "xyz01", "xyz02", etc.
Last edited by jonvanwyk; 08-18-2011 at 12:15 PM. Reason: clarity
Review tab - allow users to edit ranges, is as close as you'll get.
As an aside, Excel is not a secure application and anyone with any nous can break worksheet protection if they want to.
romperstomper: I realize that, but my target audience doesn't even know how to format a cell much less crack a worksheet. Most of the security I need is to prevent users from accidentally screwing things up.
Actually, I just had a thought that might give me exactly what I want. Presently, I am using the following code to restrict the cells that can be clicked on to only those inside of my form (A1:AM50). I noticed that while it prevents the user from selecting a cell in anyway, it does not restrict the use of macros anywhere on the page. Can I make this type of "sch.ScrollArea" user contingent?
Private Sub Workbook_SheetActivate(ByVal sh As Object) Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",True)" Application.DisplayFormulaBar = False Application.DisplayStatusBar = False If IsNumeric(sh.Name) Then sh.ScrollArea = "A1:AM50" Else sh.ScrollArea = "A1:AM50" End If End Sub
For instance, can I say:
If windows user "abc" then allow sh.ScrollArea = "A1:AM50",
but if any other user, allow sh.ScrollArea = "A1:AM1"
??
I have been trying to figure out how to do this independently, but am still at a loss. Does anyone have any suggestions?
This code will base the scroll area on the username. Let me know if it helps.
Private Sub Workbook_SheetActivate(ByVal sh As Object) Dim nm As String nm = Environ("username") Select Case nm Case "jwv" sh.ScrollArea = "A1:B25" Case "abc" sh.ScrollArea = "A20:b30" Case Else sh.ScrollArea = "A1:M30" End Select End Sub
BigBas...your solution works as I needed it to. Thank you for taking the time to answer my question.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks