Round, Ceiling, Floor Function
I found the round function from the vbcoders.com before and I grouped it with my own ceil and floor function together. I hope these could help someone who don't want to use the round and format function to handle the numeric information.
Rate Round, Ceiling, Floor Function
(3(3 Vote))
Public Function AdvRound(InValue As Double, InDecimal As Integer) As Double
Dim lDblProcess As Double
lDblProcess = InValue * (10 ^ InDecimal)
AdvRound = Int(lDblProcess + 0.5) / (10 ^ InDecimal)
End Function
Public Function AdvCeil(InValue As Double, InDecimal As Integer) As Double
Dim lDblProcess As Double
lDblProcess = InValue * (10 ^ InDecimal)
If Int(lDblProcess) < lDblProcess Then
lDblProcess = Int(lDblProcess) + 1
Else
lDblProcess = Int(lDblProcess)
End If
AdvCeil = lDblProcess / (10 ^ InDecimal)
End Function
Public Function AdvFloor(InValue As Double, InDecimal As Integer) As Double
Dim lDblProcess As Double
lDblProcess = InValue * (10 ^ InDecimal)
AdvFloor = Int(lDblProcess) / (10 ^ InDecimal)
End Function
Round, Ceiling, Floor Function Comments
No comments yet — be the first to post one!
Post a Comment