Welcome to the forum mkuznetsov1,
Try the below in the sheet 'EDP #s', the code needs to go in that sheets code window:
Private Sub Worksheet_Activate()
Dim Users As String, c As Range, pass As String
Users = Environ("USERNAME")
Set c = Worksheets("AuthUsers").Range("A1:A100").Find(Users, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
pass = "password"
If c Is Nothing Then
Application.DisplayAlerts = False
On Error Resume Next
'may already be read only
If ThisWorkbook.Path <> vbNullString Then
ThisWorkbook.ChangeFileAccess xlReadOnly
Me.Protect pass
End If
On Error GoTo 0
Application.DisplayAlerts = True
Else
Application.DisplayAlerts = False
On Error Resume Next
'may already be read only
If c = Users Then Me.Unprotect pass
On Error GoTo 0
Application.DisplayAlerts = True
End If
End Sub