I have a cell in Excel that has data stored in it in percentage format, for example -8.40% . I want to compare if the value in the cell is less than(in magnitude) -8.5% or not, if yes then some actions will follow.
So how do i write a VBA macro code to compare the value?
`If ActiveSheet.Range(range_name).Value > "-8.50%" Then Perform some action`
But this doesn’t seem to work.. so how should i do it? Thanks in advance!
-8.5% is nothing but
-8.5/100 which ultimately is
So change your code to
If ActiveSheet.Range(range_name).Value > -0.085 Then