Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Restrict, or allow, the alteration of a spreadsheet, by selected people, that is on a shared network, based on WINNT user ID. This should be transparent and users that are allowed will never see a message. However, users that are restricted will only see a message if they try to alter the file.

Oh, I see.
Typically, the etiquette followed in this forum (and most others) is to actually ask for assistance as opposed to just announcing a set or requirements and expecting people to supply a solution. People want to help, but posts come across as sort of arrogant when all they do is read like a list of demands. I'm sure you didn't mean to have it sound that way, but it does.
That said, and since we don't know your level of expertise in VBA, I'll offer this as a starting point:
Sub WhatUser() curUser = Application.UserName End SubThis will set curUser to the UserName of the person logged into the machine at the time that the macro is run.
The current UserName could be compared to a list of allowed UserNames, perhaps stored in a hidden sheet, and if found, the sheet to be edited could be unprotected and then protected again when saved.
Obviously, the code module that contained the Password to unprotect the sheet would have to be hidden and password protected also.
Let us know if you need any further assistance.

re: far from arrogant
I thought so! :)
I just played with this under my own UserName and it did indeed unprotect Sheet1:
Sub UnProtectByUser() With Sheets(2).Range("A1:A10") Set c = .Find(Application.UserName, LookIn:=xlValues) If Not c Is Nothing Then Sheets(1).Unprotect Password:="pw" End If End With End SubProtecting the sheet could be done with a BeforeSave macro.

![]() |
cab file error
|
Excel 2007 won't print to...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |