方法:先添加一个宏,然后起名。这里实例起名为MyRound

然后编辑宏弹出VBA编程窗口,在下面模块中输入:(系统生成的Sub Myround之类的全部删掉。)

Function myRound(ByVal num As Single, ByVal dec As Integer) As Single With Application.WorksheetFunction num = num * .Power(10, dec) num1 = .RoundDown(num, 0) num2 = num - num1 If num2 > 0.5 Or (num2 = 0.5 And Abs(num1 / 2 - Round(num1 / 2, 0)) > 0.00001) Then num1 = num1 + 1 num1 = num1 / .Power(10, dec) End With myRound = num1 End Function

保存后,然后在单元格中输入=myRound(单元格,小数点位数)即可

WPS四舍六入无成双怎么弄?