Good evening everyone,
does being not good in English I went through a translator
infact I have a workbook with a sheet that call "admin" with my username in column A password in column B and the name of my leaves C, D, E, F, I inserted a capital X on the line corresponding to the User column of the page to which I wish him given access if no X and hide this page
this is its gets complicated in fact I wish I could restrict access for some read-only user, and for others the total change.
you tell me add a password to the sheet but I would like this to be so kind to automate the user "Admin" to log in my userform it otez protect him because he will have total access to the reading workbook + modification.
if the user "Bernard" normally has access to the sheet 1 may continue to read my not change
I hope to have was clear in my description
thank you in advance for your assistance
if you had any questions do not hesitate I am behind the pc
here is my code currently used for identification in my file
Private Sub UserForm_Initialize()
Me.Utilisateur.List = Sheets("admin").Range("Utilisateur").Value
Me.Utilisateur.ListIndex = 0
End Sub
Private Sub MotPasse_Change()
p = Application.Match(Me.Utilisateur, Range("Utilisateur"), 0)
mdp = Application.Index(Range("MotPasse"), p)
If Not IsError(mdp) Then
If Me.motpasse = CStr(mdp) Then ok = True
End If
End Sub
Private Sub B_ok_Click()
If Me.motpasse <> "" And Me.Utilisateur <> "" Then
NbEssai = NbEssai + 1: Me.Label3.Caption = NbEssai & " essai(s)"
For i = 1 To Range("MotPasse").Count
If UCase(Me.motpasse) = UCase(Range("motpasse")(i)) And _
UCase(Me.Utilisateur) = UCase(Range("utilisateur")(i)) Then
For j = 1 To [feuille].Count
If Range("droits").Cells(i, j) = "X" Then
temp = Range("feuille")(j)
Sheets(temp).Visible = True
End If
Next j
Sheets("Espion").[M2] = Me.Utilisateur
Unload Me: Exit Sub
End If
Next i
End If
If NbEssai > 3 Then
MsgBox NbEssai & " essais!"
ThisWorkbook.Close False
End If
End Sub
here is my page Admin
Capture.PNG
Bookmarks