Public WithEvents CB As MSForms.CommandButton
Private Sub CB_Click()
Dim t$
t = Calculatrice.txtResultat
If CB.Caption = "CE" Then t = "": GoTo 1
If CB.Caption = "C" Then t = Left(t, Len(t) - 1): GoTo 1
If CB.Caption = "=" Then
If Not t Like "*#" And Not t Like "*%" Then t = Left(t, Len(t) - 1)
t = Replace(CStr(Evaluate(t)), ",", ".")
If t Like "Err*" Then t = "E" 'si erreur
Else
If t & CB.Caption Like "0#" Or t = "E" Then t = ""
If Not IsNumeric(CB.Caption) And Not t Like "*#" And Not t Like "*%" Then Exit Sub
t = t & CB.Caption
End If
1 If t = "" Then t = 0
Calculatrice.txtResultat = t
End Sub