Bonjour DeadPool_CC
voici mon code, j'ai des problèmes dans la section <.30
et >180$ j'ai appliqué tes conseilles mais je suis bloqué pour l'instant.
Merci pour tout
Voila mon code et je joint le fichier.
Function Ch_Rd#(ByVal Valeur#)
With Application.WorksheetFunction
Select Case Valeur
Case Is <= 0.3
Ch_Rd = .Round(Valeur, 2)
Case 0.301 To 4.99
Ch_Rd = Valeur - .RoundDown(Valeur, 0)
Select Case Ch_Rd
Case Is < 0.38
Ch_Rd = 0.38 + .RoundDown(Valeur, 0)
Case Else
Ch_Rd = .RoundDown(Valeur, 1) + 0.08
End Select
Case 5# To 9.99
Ch_Rd = Valeur - .RoundDown(Valeur, 0)
Select Case Ch_Rd
Case Is < 0.29
Ch_Rd = 0.28 + .RoundDown(Valeur, 0)
Case Is < 0.49
Ch_Rd = 0.48 + .RoundDown(Valeur, 0)
Case Is < 0.79
Ch_Rd = 0.78 + .RoundDown(Valeur, 0)
Case Else
Ch_Rd = 0.98 + .RoundDown(Valeur, 0)
End Select
Case 10# To 39.99
Ch_Rd = Valeur - .RoundDown(Valeur, 0)
Select Case Ch_Rd
Case Is < 0.49
Ch_Rd = 0.48 + .RoundDown(Valeur, 0)
Case Else
Ch_Rd = 0.98 + .RoundDown(Valeur, 0)
End Select
Case 40# To 179.99
Ch_Rd = (Valeur / 10) - .RoundDown(Valeur / 10, 0)
Select Case Ch_Rd
Case Is < 0.3
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.298) * 10
Case Is < 0.5
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.498) * 10
Case Is < 0.8
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.798) * 10
Case Else
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.998) * 10
End Select
Case Is < 180#
Ch_Rd = (Valeur / 10) - .RoundDown(Valeur / 10, 0)
Select Case Ch_Rd
Case Is < 0.3
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.298) * 10
Case Is < 0.5
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.498) * 10
Case Is < 0.8
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.798) * 10
Case Else
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.998) * 10
End Select
Case Else
Ch_Rd = (Valeur / 10) - .RoundDown(Valeur / 10, 0)
Select Case Ch_Rd
Case Is < 0.5
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.498) * 10
Case Else
Ch_Rd = (.RoundDown(Valeur / 10, 0) + 0.998) * 10
End Select
End Select
End With
End Function