在VB中,Round函数用于将一个数值四舍五入到指定的小数位数。该函数的用法如下:
Round(number, [decimal_places])
参数:
返回值:
示例: 以下示例演示了Round函数的用法:
Dim num As Double num = 3.14159
Dim roundedNum As Double roundedNum = Round(num) ’ 结果为:3
Dim roundedNum2 As Double roundedNum2 = Round(num, 2) ’ 结果为:3.14