Private Sub CommandButtonValid_Click()
If textboxvisa.Value = "" Then
MsgBox ("Il faut saisir l'opérateur !")
textboxvisa.SetFocus
Exit Sub
End If
Dim valides
Dim i&
Dim bool As Boolean
valides = Array("toto", "tata", "kiki", "coco") 'ajouter les noms valides
For i& = LBound(valides) To UBound(valides)
If textboxvisa.Value = valides(i&) Then
bool = True
Exit For
End If
Next i&
If Not bool Then
MsgBox ("Opérateur non reconnu !")
textboxvisa.Value = ""
textboxvisa.SetFocus
Exit Sub
End If
If TextBoxNLL1.Value = "" Then
MsgBox ("Saisie manquante !")
TextBoxNLL1.SetFocus
Exit Sub
End If
If IsNumeric(TextBoxNLL1.Value) Then
If TextBoxNLL1.Value > 25 Then
MsgBox ("Valeur supérieure à 25 mmm !")
TextBoxNLL1.Value = ""
TextBoxNLL1.SetFocus
Exit Sub
End If
Else
If TextBoxNLL1.Value <> "M" Then
MsgBox ("Valeur différente de M !")
TextBoxNLL1.Value = ""
TextBoxNLL1.SetFocus
Exit Sub
End If
End If
End Sub