Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Dim strpass As String
strpass = TextBox2.Value
If ChainePasOK(strpass) = True Then Cancel = True: TextBox2.Value = "": Beep: MsgBox "Saisie invalide concernant le numéro de FSE !"
End Sub
Private Function ChainePasOK(strpass As String) As Boolean
If strpass = "" Then Exit Function
If Len(Replace(strpass, ".", "")) <> Len(strpass) Then ChainePasOK = True: Exit Function
If Len(strpass) = 1 And InStr("1234567890", strpass) = 0 Then ChainePasOK = True: Exit Function
strpass = Replace(strpass, ",", ".")
If Len(CStr(Val(strpass))) <> Len(strpass) Then ChainePasOK = True
End Function