'Compare integer to see if needs rounding up
If dblNumNum_Digits - intNumNum_Digits >= 0.5 Then
'round up
intNumNum_Digits = intNumNum_Digits + 1
Else
'round down
intNumNum_Digits = intNumNum_Digits
End If
'Return result, moving decimal point back
Round = intNumNum_Digits / (10 ^ Num_Digits)
End Function
Function MRound(Number As Double, Multiple As Double) As Double
'Set up variables
Dim dblDivided As Double
Dim dblIntDivided As Double
'Divide
dblDivided = Number / Multiple
'Integerise
dblIntDivided = Int(dblDivided)
'Round dblDivided to nearest whole number in intDivided
dblIntDivided = dblIntDivided + Round(dblDivided - dblIntDivided, 0)
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.