Bonjour,
J'ai besoin de récupérer un pourcentage en format nombre pour divers traitements et j'y suis arrivé à moitié. Le code que j'ai écrit ne renvoie pas la bonne valeur. Par exemple, la saisie d'un taux à 2,30% renvoie 2,00% (Problème d'arrondi). Comme je tourne en boucle, j'appelle ce forum à l'aide.
Merci par avance.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    TextBox2.Value = Format(Val(TextBox2.Value) / 100, "0,00%")
    TextBox2.Value = Replace(TextBox2.Value, ",", ".")
End Sub
 
 
Private Sub CommandButton1_Click()
 
Range("A2").Value = TextBox1.Value
 
[A3] = TextBox2.Value
[A3].NumberFormat = "0,00%"
 
TextBox3.Value = Format([A3].Value, "0.00%")
 
End Sub