Roundoff a decimal number

This sample code shows how to roundoff a decimal number.

Function SRound(Real As Double) As Integer
Dim tmp As Integer
tmp = Val(Real)
If Real - tmp >= 0.5 Then
SRound = tmp + 1
SRound = tmp
End If
End Function


Author: Kaushal Kishore Govil29 Dec 2010 Member Level: Silver   Points : 1

yes We have Math.Round(decimal/double)
Math.Round(decimal/double, int number)

number of digits: The number of significant digits (precision) in the return value.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: