home *** CD-ROM | disk | FTP | other *** search
- Function Round (n, d)
-
- ' Accepts: a variant value
- ' Purpose: converts multiplace decimal numbers
- ' Returns: a number rounded to d decimal places
- ' or a zero if the value it was called for was null
- ' If d is negative or null d is set to 0 and the function is like Int()
- ' In any case d is set to Int(d)!
- ' Author: Marcus O. M. Grabe, CIS 100120,1405
- ' Please send a message, if you like it or if you have any suggestions.
-
- If IsNull(n) Or IsNull(d) Then
- Round = 0
- Else
- If d < 0 Then
- d = 0
- Else
- d = Int(d)
- End If
- Round = CLng(n * (10 ^ d)) / (10 ^ d)
- End If
-
- End Function
-