### Abs (function)

 Syntax Abs(expression) Description Returns the absolute value of expression. Comments If expression is Null, then Null is returned. Empty is treated as 0. The type of the result is the same as that of expression, with the following exceptions: If expression is an Integer that overflows its legal range, then the result is returned as a Long. This only occurs with the largest negative Integer:     Dim a As Variant     Dim i As Integer     i = -32768     a = Abs(i)      'Result is a Long.     i = Abs(i)      'Overflow! If expression is a Long that overflows its legal range, then the result is returned as a Double. This only occurs with the largest negative Long:     Dim a As Variant     Dim l As Long     l = -2147483648     a = Abs(l)      'Result is a Double.     l = Abs(l)      'Overflow! If expression is a Currency value that overflows its legal range, an overflow error is generated. Example This example assigns absolute values to variables of four types and displays the result. Sub Main()   s1% = Abs(-10.55)   s2& = Abs(-10.55)   s3! = Abs(-10.55)   s4# = Abs(-10.55)   MsgBox "The absolute values are: " & s1% & "," & s2& & "," & s3! & "," & s4# End Sub See Also Sgn (function).
 A