1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Dim purcent As String
Function TestNumeric(V) As Double
Dim t
t = Replace(V, ",", ".")
If IsNumeric(t) = True Then TestNumeric = t: Exit Function
t = Replace(t, ".", ",")
If IsNumeric(t) = True Then TestNumeric = t: Exit Function
End Function
Private Sub OptionButton2_Change()
purcent = Me.OptionButton2.Caption
Calcul Me.OptionButton2.Caption
End Sub
Private Sub ListBox1_Click()
Dim Lign As Integer
If ListBox1.ListIndex = -1 Then Exit Sub
With Sheets("Donné")
Lign = .Columns(2).Cells.Find(ListBox1.List(ListBox1.ListIndex)).Row
Label14 = .Range("D" & Lign)
Label15 = .Range("A" & Lign)
Label16 = .Range("B" & Lign)
Label17 = .Range("C" & Lign)
Calcul purcent
End With
End Sub
Private Sub OptionButton1_Change()
purcent = Me.OptionButton1.Caption
Calcul Me.OptionButton1.Caption
End Sub
Sub Calcul(PourCent As String)
TextBox1 = TestNumeric(Trim("" & Replace(PourCent, "%", ""))) * 1 / 100 * TestNumeric(Label17.Caption)
End Sub |
Partager