XL 2016 saisir un login deux foix dans deux userform differents

nada bahri

XLDnaute Nouveau
salut , dans mon projet VBA j'ai deux UserForme Differents et l'une l'une aprés l'autre , je veux saisir un login en 2 eme fois dans (UserFormModif) identique a celui du depart (UserFormLOGIN)
ici dans mon code le teste se fait pour tous les login qui se trouve , est ce que existe ou pas , or que je besoin de tester sur le login saisi au debut uniquement ,
voila mon code
Private Sub CommandButton5_Click()
Dim O As Worksheet
Dim TV As Variant
Dim I As Integer
Dim TEST As Boolean
Dim no_ligne As Integer

Set O = Worksheets("SHEET1")
TV = O.Range("A1").CurrentRegion
For I = 2 To UBound(TV, 1)
If TV(I, 1) = Me.TextBox14.Value Then
no_ligne = I
TEST = True
Exit For
End If
Next I
If TEST = True Then
MsgBox "ok"
TextBox1.Value = Cells(no_ligne, 2).Value
TextBox2.Value = Cells(no_ligne, 3).Value
ComboBox2.Value = Cells(no_ligne, 4).Value
ComboBox3.Value = Cells(no_ligne, 5).Value
TextBox5.Value = Cells(no_ligne, 6).Value
ComboBox4.Value = Cells(no_ligne, 7).Value
TextBox7.Value = Cells(no_ligne, 8).Value
TextBox8.Value = Cells(no_ligne, 9).Value
TextBox9.Value = Cells(no_ligne, 10).Value
TextBox10.Value = Cells(no_ligne, 11).Value
TextBox12.Value = Cells(no_ligne, 12).Value
TextBox11.Value = Cells(no_ligne, 13).Value
TextBox13.Value = Cells(no_ligne, 14).Value

Me.TextBox1.Enabled = False
Me.TextBox2.Enabled = False
Me.ComboBox2.Enabled = False
Me.ComboBox3.Enabled = False
Me.TextBox5.Enabled = False
Me.ComboBox4.Enabled = False
Me.TextBox7.Enabled = False
Me.TextBox8.Enabled = False
Me.TextBox9.Enabled = False
Me.TextBox10.Enabled = False
Me.TextBox12.Enabled = False
Me.TextBox11.Enabled = False
Me.TextBox13.Enabled = False
Else
MsgBox "login incorrect"
End If



End Sub


et voici mon application pour mieux comprendre
Ps: j'ai tester aussi :
if UserFormLOGIN.TextBox1.value = UserFormMODIF.TextBox14.value THEN
Msgbox"ok"
else
Msgbox " login incorrect"
End if
 

Pièces jointes

  • formulaire V3.4.xlsm
    748.1 KB · Affichages: 13

Discussions similaires

Réponses
0
Affichages
137

Statistiques des forums

Discussions
312 103
Messages
2 085 321
Membres
102 862
dernier inscrit
Emma35400