Pour entrer dans mon fichier, une fenêtre VBA s'affiche, pour demander un login et un mot de passe. Ces informations sont stockées dans une feuille, nommée _emply. Malheur: j'ai ajouté deux lignes à la table _emply et voilà que je ne peux plus me connecter. Seulement avec 1 seul nom d'utilisateur je peux entrer, les 3 autres, le programme semble ne plus le reconnaître

Voici mon code:
Code: Select all
Private Sub cmdvaliderlogin_Click()
Dim login As Variant
Dim prenom As Variant
Dim nom As Variant
Dim departement As Variant
Dim grade As Variant
Dim mdp As Variant
login = txtuser.Text
Sheets("_emply").Activate
mdp = WorksheetFunction.VLookup(login, Range("EMPLOYES"), 2, True)
nom = WorksheetFunction.VLookup(login, Range("EMPLOYES"), 3, True)
prenom = WorksheetFunction.VLookup(login, Range("EMPLOYES"), 4, True)
departement = WorksheetFunction.VLookup(login, Range("EMPLOYES"), 5, True)
grade = WorksheetFunction.VLookup(login, Range("EMPLOYES"), 6, True)
If mdp = txtmdp.Text Or mdp = UCase(txtmdp.Text) Then
MsgBox ("Ouverture du programme pour " & prenom & " " & nom & " ...")
Sheets("_dta").Activate
Range("K7").value = login
Range("K8").value = prenom
Range("K9").value = nom
Range("K10").value = departement
Range("K11").value = grade
Range("K12").value = mdp
Sheets("MAIN_SCREEN").Activate
If grade = "A" Then
MenuA.Show
StartUp.Hide
End If
If grade = "U" Then
MenuU.Show
StartUp.Hide
End If
Else
MsgBox ("Erreur de saisie" & vbNewLine & "Réessayez ou contactez l'administrateur système")
txtuser.Text = ""
txtmdp.Text = ""
txtuser.SetFocus
End If
End Sub