Hi Sourav ,
You can make use of the Application.Evaluate function ; however , what this evaluates are strings which resolve to valid expressions.
A string expression such as :
str1 = "a = b"
is not an expression , but just a text string.
Note : I have used str1 and not str , since Str is a VBA keyword representing a function. Never use keywords as variable names.
In order for the Application.Evaluate to correctly evaluate the expression that you want evaluated , try this :
str1 = "=" & a & ">" & b
What will be done here is that the values contained in the variables a and b will be inserted in the string , so that what the Application.Evaluate function gets will be the following :
str1 = "=10>5"
assuming that the variable a has been assigned the value 10 , and the variable b has been assigned the value 5.
Thus , the following :
?Application.Evaluate(str1)
entered in the Immediate window , will get the result True.
Narayan