# VBA ROUND Function

HomeVBA Functions LIST (Category Wise)How to use the VBA ROUND Function (Syntax + Example)

## What is VBA ROUND Function

The VBA ROUND function is listed under the math category of VBA functions. When you use it in a VBA code, it rounds a number to specific decimals places. In simple words, with ROUND you can round a number and you can specify the decimals places you want to round that number to.

## how to use it

To use VBA's ROUND function you need to understand its syntax and arguments:

### Syntax

Round(Number, [NumDigitsAfterDecimal])

### Arguments

• Number: The number you want to round.
• [NumDigitsAfterDecimal]: The number of decimal places that you want to round to [This is an optional argument and if omitted VBA takes 0 by default].

## Example to use ROUND Function in VBA

To practically understand how to use VBA ROUND function, you need to go through the below example where we have written a vba code by using it:

```Sub example_ROUND()
Range("B1").Value = Round(Range("A1"), 2)
End Sub```

In the above code, we have used ROUND to round the number that we have in the cell A1 and in the result, it has round that 15 decimals number to two decimals number.