Calcul textbox

Bonjour,

Je recherche la façon de calculer deux textbox

J'ai déjà un code qui fonctionne très bien mais je voudrais lui apporter une modification

Mon code.

Private Sub T14_AfterUpdate()
T14.Value = Format(T14.Value, "00.00 €")
End Sub
Private Sub T16_AfterUpdate()
T16.Value = Format(T16.Value, "00.00 €")
End Sub
Private Sub T18_AfterUpdate()
T18.Value = Format(T18.Value, "00.00 €")
End Sub
Private Sub T34_AfterUpdate()
T34.Value = Format(T34.Value, "00.00 €")
End Sub
Private Sub TextBox8_AfterUpdate()
TextBox8.Value = Format(TextBox8.Value, "00.00 €")
End Sub
Function calc() As Double
    calc = Val(T14) - Val(T16) - Val(T18) + Val(T34)
End Function
Private Sub T14_Change()
    T19 = Format(calc, "# ##0.00 €")
 TextBox8.Value = T14.Value + T34.Value  
End Sub
Private Sub T16_Change()
    T19 = Format(calc, "# ##0.00 €")
End Sub
Private Sub T18_Change()
    T19 = Format(calc, "# ##0.00 €")
End Sub
Private Sub T34_Change()
    T19 = Format(calc, "# ##0.00 €")  
    TextBox8.Value = Val(T14.Value) + Val(T34.Value)  
End Sub

Private Sub CheckBox16_Change()
If CheckBox16.Value = True Then
CheckBox17.Value = False
End If
TTC = Val(Replace(TextBox8, ",", "."))
TVA = TTC / 1.196
TextBox6.Visible = False
Label280.Visible = False
TextBox5.Visible = True
Label9.Visible = True
TextBox7.Text = Format(TVA, "# ##0.00 €")
TextBox5.Text = Format(TTC - TVA, "# ##0.00 €")
End Sub

Private Sub CheckBox17_Change()
If CheckBox17.Value = True Then
CheckBox16.Value = False
TTC = Val(Replace(TextBox8, ",", "."))
TVA = TTC / 1.055
TextBox5.Visible = False
Label9.Visible = False
TextBox6.Visible = True
Label280.Visible = True
TextBox7.Text = Format(TVA, "# ##0.00 €")
TextBox6.Text = Format(TTC - TVA, "# ##0.00 €")
End If
End Sub
'Copie T19 vers TextBox4
Private Sub T19_Change()
TextBox4.Value = T19.Value
End Sub

Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    TextBox8.Value = Format(Replace(TextBox8.Value, ".", ","), "#0.00 €")
End Sub
Private Sub TextBox5_Change()
TextBox9.Value = TextBox5.Value + TextBox6.Value
End Sub
Private Sub TextBox6_Change()
TextBox9.Value = Val(TextBox5.Value) + Val(TextBox6.Value)
End Sub

Je joint mon fichier avec mon explication

Je vous remercie d'avance

Cordialement

Max

217calcul-textbox.xlsm (44.49 Ko)

Bonjour

Tu avais fait 99% du travail

A tester

Bonjour Banzai

Je te remercie Nickel

Bonne journée

Max

Rechercher des sujets similaires à "calcul textbox"