CREATING A CUSTOM ROUND FUNCTION



0
Function CustomRound(pValue As Double) As Double

Dim LWhole As Long
Dim LFraction As Double

'Retrieve integer part of the number
LWhole = Int(pValue)

'Retrieve the fraction part of the number
LFraction = pValue - LWhole

If LFraction < 0.5 Then
CustomRound = LWhole
Else
CustomRound = LWhole + 0.5
End If

End Function