我写了个保留一位小数的四舍六入的函数,可是不知哪里出了点问题,程序运行不了,逐步调试也运行到if那就没了 请帮忙看看,谢谢
Public Function my_round(A As Double, B As Double) As Double
With Application.WorksheetFunction
c = (A + B) / 2
d = .mod(Abs(c) * 100, 20)
If d = 5 Then
my_round = Abs(.Round(c, 1) - 0.1) * Sgn(c)
Else
my_round = Abs(.Round(c, 1)) * Sgn(c)
End If
End With
End Function