在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