MsgBox avec condition
Résolu
Bourrique66
Messages postés
166
Statut
Membre
-
Bourrique66 Messages postés 166 Statut Membre -
Bourrique66 Messages postés 166 Statut Membre -
Private Sub TextBox33_Change()
Application.ScreenUpdating = False
TextBox33.Value = Format(TextBox33.Value, "0 Mois")
Dim test As Boolean
With TextBox33
test = Val(Replace(.Text, ",", ".")) >= 6
.BackColor = IIf(test, vbRed, vbGreen)
.ForeColor = IIf(test, vbWhite, vbBlack)
.Font.Bold = test
End With
If Me.TextBox33.Value >= 6 Then
MsgBox "Attention produit anti-crevaison route dépassé"
End If
Application.ScreenUpdating = True
End Sub
4 réponses
Bonjour
Essaie ainsi
Private Sub TextBox33_Change()
If Right(TextBox33.Value, 1) = "s" Then Exit Sub
Application.ScreenUpdating = False
TextBox33.Value = Format(TextBox33.Value, "0 Mois")
Dim test As Boolean
With TextBox33
test = Val(Replace(.Text, ",", ".")) >= 6
If test = True Then MsgBox "Attention produit anti-crevaison route dépassé"
.BackColor = IIf(test, vbRed, vbGreen)
.ForeColor = IIf(test, vbWhite, vbBlack)
.Font.Bold = test
End With
Application.ScreenUpdating = True
End Sub
Cdlmnt
Via
Merci Via ;
votre code fonctionne parfaitement, si vous avez le temps pourriez-vous mettre des commentaires dans votre code afin que je puisse le comprendre pour pouvoir le reproduire. Bien sûr si vous avez le temps. Merci de votre patience