README.md
December 3, 2022 ยท View on GitHub
Description
This code makes easy work of doing simple rounding on decimal number...something that VB currently lacks. Why didn't they think of this?
More Info
Number (double data type)
RoundNum (Integer)
Rounding financial stuff is not cool :)
| Submitted On | |
| By | Matt Roberts |
| Level | Intermediate |
| User Rating | 4.6 (23 globes from 5 users) |
| Compatibility | VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script |
| Category | VB function enhancement |
| World | Visual Basic |
| Archive File |
Source Code
' Paste this code directly into your IDE. This has not yet been tested on VBScript, but should work if you drop the type declarations.
Function RoundNum(Number As Double) As Integer
If Int(Number + 0.5) > Int(Number) Then
RoundNum = Int(Number) + 1
Else
RoundNum = Int(Number)
End If
End Function