# Round VBA function – How to round a number

Last Updated on January 11, 2023 by token

## Round VBA Function – Description

The Round VBA function is used to round numbers with decimal places. How can we use the Round function? In place of the first argument of the function, enter the number you want to round. In place of the second argument, enter the number of decimal places to which you want to round the number.

If you want to return a value with no decimal places, do not enter the second argument of the function. The result will be an integer. You can also obtain an integer after using the VBA Fix or VBA Int functions .

## VBA Round function – Syntax

```'OfficeInside.Org
Round(Number, [NumDigitsAfterDecimal As Long]) ```

Number : The number we want to round.

NumDigitsAfterDecimal : Optional argument. The number of decimal places to which you want to round the number.

Function return : Numeric value.

## VBA Round function – Example

How to use Round function in VBA Excel? Below is an example of using the Round function in the VisualBasic Editor.

Example 1 : Rounding a number using Round function. The result will appear in the MsgBox window and the sheet cell.

``````'OfficeInside.Org
Sub RoundFunctionExample()
MsgBox Round(5.123)
MsgBox Round(987.123456, 2)
Range("A1") = Round(3.141234, 3)
MsgBox Round(Range("a1"), 2)
End Sub``````