The Abs function returns the absolute value of a Long integer. In other words, it removes any negative sign and returns the magnitude of the number. This is especially useful in calculations where only the size of a value matters, regardless of whether it was originally positive or negative—such as distance, difference comparisons, error magnitudes, or general numeric normalization.
When Abs is applied to a negative number, it converts it to its positive equivalent. If the value is already positive (or zero), it is returned unchanged.
Example
Dim A As Long, B As Long B = -1234 A=Abs B ' Return |B|. Debug Dec A ' Print 1234
See also FAbs.