This function should do the trick. Just call it with the number you wish to round down and the number of values after the decimal place you wish.
Private Function RoundDown(dblNum As Double, intPlacesAfterDecimal As Integer) As Double
RoundDown = CDbl(Left(CStr(dblNum), intPlacesAfterDecimal + 2))
End Function
Replace the 3 with the number of places you need to round down using a literal number like above or a variable
Public Function RoundDown(dNumber As Double, Optional ByVal lDecimalPlaces As Long = 2) As Double
There are several different options depeding on what you want to do.
Probably the best option, if you a novice, would be to simply copy and paste the code into the form you wish to call the function from.
If your feeling brave you could try putting into a module or class file and making it public so you can access it from other forms and classes, but if your not sure how to do that stick with the first method.
Also the last method suggested by CCLINT will work move flexibly than the method I suggested so I would recommend using that.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.