Bonjour,
J'ai écrit ce code pour permettre aux utilisateurs de se connecter et d'avoir accès à certaines informations; Quand je veux valider la formule ça ne marche pas. Qu'est ce j'ai omis ? Merci !
Private Sub CommandButton1_Click()
Dim Feuil As Worksheet
Dim MDP
On Error Resume Next
If Me.TextBox1.Value = "" Then
MsgBox "Please enter your login !", vbOKOnly + vbExclamation, "Error !"
Exit Sub
If Me.TextBox2.Value = "" Then
MsgBox "Please enter your password !", vbOKOnly + vbExclamation, "Error !"
Exit Sub
End If
MDP = Application.WorksheetFunction.Index(Range("password"), Application.WorksheetFunction.Match(Me.TextBox1.Value, _
Range("login"), 0), 1)
If Me.TextBox2.Value <> MDP Then
MsgBox "your password is incorrect !", vbOKOnly + vbCritical, "Error !"
Else
For Each Feuil In Sheets
If Feuil.Name <> "Login" Then
If Application.WorksheetFunction.Index(Range("plage"), Application.WorksheetFunction.Match( _
Me.TextBox1.Value, Range("Login"), 0), Application.WorksheetFunction.Match(Feuil.Name, Range("entete"), 0)) = "Oui" Then
Feuil.Visible = xlSheetVisible
Else
Feuil.Visible = xlSheetVeryHidden
End If
Next
End If
End Sub
Merci de m'aider!!!