To apply the ABS function in excel cells using VBA Excel.
Here we are applying ABS function in column B as shown in the image below. ABS function determines the absolute value of a number, which means how far is number from zero. For example, absolute value of -15 is 15, which represents how far is -15 from 0. Absolute value is never negative.In the code below we are looping through row 2 to row 5.We are applying the ABS formula in column B.
Sub FindAbsoluteValue() For i = 2 To 5 'Apply ABS formula in cloumn B Range("B" & i).Formula = "=ABS(" & "A" & i & ")" Next i End Sub
In the image below we can see that absolute value of -10 is 10, while absolute value of 2 is 2.
Post you may like