函数 VBA Abs 返回数字的绝对值。
Abs(数字)
将 Abs 函数应用于减法结果以获得正结果:
Sub AbsExample() number1 = 124.54 number2 = 189.36 difference = Abs(number1 - number2) 'Abs(-64.82) MsgBox difference '回报:64.82 difference = Abs(number2 - number1) 'Abs(64.82) MsgBox difference '还返回:64.82 End Sub