XL 2010 VBA: Erreur lors d'une multiplication des des chiffres avec virgule

TheProdigy

XLDnaute Impliqué
Bonjour,

J'ai crée deux texbox de saisi de chiffres "Nombre" et "Prix". La multiplication ne fonctionne pas quand je saisis des chiffres avec virgule.
Merci.
upload_2018-5-7_14-13-12.png
 

Pièces jointes

  • Saisi1.xlsm
    58.1 KB · Affichages: 40

TheProdigy

XLDnaute Impliqué
J'ai crée un Label LAbel14,

Est-il possible dans VBA d'afficher le montant total instantanément lors de la saisi du nombre et du prix avant d’appuyer sur Valider

Label 14 = nombre * prix

Merci
 

Pièces jointes

  • Saisi1.xlsm
    53 KB · Affichages: 41

Lone-wolf

XLDnaute Barbatruc
Bonjour à tous :)

@adilprodigy

Private Sub TextBox2_AfterUpdate()
Dim Total As Double ' À mettre en entête du formulaire
Total = Val(Replace(TextBox1, ",", ".")) * Val(Replace(TextBox2, ",", "."))
Label14.Caption =Format(Total, "0.000")
End Sub

Cells(no_ligne, 12) = Format(Val(Label14.Caption), "0.000")
MsgBox Format(Total, "0.000")


Utilise TAB du clavier.
 
Dernière édition:

TheProdigy

XLDnaute Impliqué
Bonjour à tous :)

@adilprodigy

Private Sub TextBox2_AfterUpdate()
Dim Total As Double ' À mettre en entête du formulaire
Total = Val(Replace(TextBox1, ",", ".")) * Val(Replace(TextBox2, ",", "."))
Label14.Caption =Format(Total, "0.000")
End Sub

Cells(no_ligne, 12) = Format(Val(Label14.Caption), "0.000")
MsgBox Format(Total, "0.000")


Utilise TAB du clavier.
Merci beaucoup @Lone-wolf
 

Statistiques des forums

Discussions
312 273
Messages
2 086 694
Membres
103 372
dernier inscrit
BibiCh