Bonjour à tous,
Dans une textbox standard je souhaiterais avoir deux variables pour valider le formulaire:
- Il faut que ça commence soit par B soit par TM
J'ai donc deux options:
Private Sub TextBox_TM_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox_TM.Text Like "B*"
Else
MsgBox "LA VALEUR RENSEIGNÉE NE CORRESPOND PAS A UNE BOITE!", vbCritical, "ERREUR:"
TextBox_TM.Value = ""
Cancel = True
End If
End Sub
ou
Private Sub TextBox_TM_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If InStr(1, TextBox_TM.Value, "TM", vbTextCompare) = 0 Then
MsgBox "LA VALEUR RENSEIGNÉE NE CORRESPOND PAS A UNE TM!", vbCritical, "ERREUR:"
TextBox_TM.Value = ""
Cancel = True
End If
End Sub
Mais je n'arrive pas à faire que
"si ça commence par B ou TM je peux valider, sinon erreur".
Merci pour votre aide.