# VBA ABS Function (Get Absolute Value)

Contents

The VBA ABS function is listed under the math category of VBA functions. When you use it in a VBA code, it returns an absolute number in the result. In simple words, it returns a non-negative number which means if you specify a negative number it will remove its sign and returns it in the result.

Abs(Number)

## Arguments

• Number: The number which you want to convert into an absolute value (number).

## Example

To practically understand how to use the VBA ABS function, you need to go through the below example where we have written a VBA code by using it:

``````Sub example_ABS()
Range("B1").Value = Abs(Range("A1"))
End Sub``````

In the above example, we have used the value from cell A1 where we have a negative number (-1029) and then we have used the ABS function to convert that value into an absolute number and enter that value in cell B1. So basically when you run this code it simply takes the value from cell A1 and converts it into an absolute number.