Method: Round for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: Round for VBS
Method: Round for VBS
Rounds a number to the specified number of decimal places.
vRound = Object.Round(expression, [numdecimalplaces])
| Object | VBS Object with this method. You do not need to specify this object. |
| expression | Variant Specifies the number you want to round. |
| [numdecimalplaces] | Variant Specifies the number of decimal places to which the Round method rounds off. If you do not specify a value, the method rounds to integer values. |
| vRound | Variant Receives the rounded number. |
The following example rounds the number Pi to two decimal places:
Dim MyVar Myvar = Round(Pi, 2) ' Pi is 3.14159265358979 Call MsgBox(MyVar) ' Returns 3.14