Private Sub Box_gains_AfterUpdate()
Box_Gains.Value = Format(Box_Gains.Value, '# ##0.000')
Calcul
End Sub
Private Sub Box_gains_mix_AfterUpdate()
Box_Gains_Mix.Value = Format(Box_Gains_Mix.Value, '# ##0.000')
Calcul
End Sub
Private Sub Box_mix_AfterUpdate()
If Right(Box_Mix, 1) <> '%' Then Box_Mix.Value = Format(Box_Mix.Value / 100, '0%')
Calcul
End Sub
Private Sub Box_gains_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii <> 46 Then
If KeyAscii < 48 Then
KeyAscii = 0
ElseIf KeyAscii > 57 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub Box_gains_mix_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii <> 46 Then
If KeyAscii < 48 Then
KeyAscii = 0
ElseIf KeyAscii > 57 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub Box_mix_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii <> 46 Then
If KeyAscii < 48 Then
KeyAscii = 0
ElseIf KeyAscii > 57 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub Calcul()
Dim Mix As Double
If Box_Gains = '' Or Box_Mix = '' Then Exit Sub
If Right(Box_Mix, 1) = '%' Then Mix = Left(Box_Mix, Len(Box_Mix) - 1) / 100
Box_Gains_Mix = Box_Gains * Mix
Sheets('Feuil1').Range('A1') = CDbl(Box_Gains_Mix)
End Sub