Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Calcul TextBox

2 réponses
Avatar
DAVID
Bonsoir

J'utilise cette procédure pour calculer un prix au litre

Private Sub TxtLitre_Change()
TxtPrixLitre.Value = Val(TxtMontant.Value) / Val(TxtLitre.Value)
End Sub

Le problème est quand on efface le montant de TxtLitre cela crée une erreur.

Merci de votre aide

David

2 réponses

Avatar
Daniel.C
Bonsoir.
Si j'ai bien compris :
If TxtLitre <> "" then
TxtPrixLitre.Value = Val(TxtMontant.Value) / Val(TxtLitre.Value)
Else
' à toi de voir
end if
Daniel

Bonsoir

J'utilise cette procédure pour calculer un prix au litre

Private Sub TxtLitre_Change()
TxtPrixLitre.Value = Val(TxtMontant.Value) / Val(TxtLitre.Value)
End Sub

Le problème est quand on efface le montant de TxtLitre cela crée une erreur.

Merci de votre aide

David


Avatar
DAVID
Bonsoir

Merci. Je vais adapter au besoin

Bonne soirée