Hi everyone,
I have a set of numbers that must be analized with the comparison operators. It would be really efficient if I could pass these operators as paramaters.
I tried to solve this with the Evaluate function and it works when I compare whole numbers but when I switch to decimal numbers it gives me the type mismatch error.
Can someone please explain why this code doesn't work for decimal numbers?
Here is a data sample that the code must run on.
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
I have a set of numbers that must be analized with the comparison operators. It would be really efficient if I could pass these operators as paramaters.
I tried to solve this with the Evaluate function and it works when I compare whole numbers but when I switch to decimal numbers it gives me the type mismatch error.
Can someone please explain why this code doesn't work for decimal numbers?
Code:
Sub test(op1 As String)
Dim c As Range
For Each c In ActiveSheet.Range("A1:A10")
If Evaluate(c.Value & op1 & c.Offset(0, 1)) Then MsgBox "It works"
Next c
End Sub
Sub caller()
test "<"
End Sub
Here is a data sample that the code must run on.
1 | 2 |
2 | 3 |
0,127 | 0,0841 |
0,108 | 0,0812 |
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>