Hi there,

I obtained code to round down a number to a second non-zero digit. Unfortunately, it doesn't work properly. When dblX is 82.02, I would like to round down this number to 82. Would you have any idea how to modify the code so that I works properly?

Thanks for your help!


Public Function RoundDown2ndDigit(ByVal dblX As Double, Optional ByVal dblStep As Double) As Double
Dim strE As String, dblM As Double

strE = Format(Abs(dblX), "0.0E+0")
dblStep = CDbl("0.1E" & Mid(strE, 5))
dblM = CDbl(strE)
If dblM > Abs(dblX) Then dblM = dblM + dblStep
RoundDown2ndDigit = (Sgn(dblX) * dblM)

End Function