Link to home
Start Free TrialLog in
Avatar of tiehaze
tiehaze

asked on

Evaluate Function and Chr(34) in excel vba

This statement below is true, but it is not recognizing it as true. I assume it is because I need to put the Chr(34) somewhere but I do not know where I need to. Can you help me?

If Application.Evaluate(Chr(34) & InStr(r.Offset(0, VarA1).Value, VarC1) > 0 & Chr(34)) Then run code a

ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tiehaze
tiehaze

ASKER

the code I am using is very complicated, I just threw in that one line

The reason I am using evaluate is because I have a variable that is equal to:
=
<> 
>
<
and the only way to use those is with evaluate.
Avatar of tiehaze

ASKER

nevermind, you are correct. thanks
If you have an operator, as in your earlier question, you do not need the Chr(34) at all. This is because you are concatenating several values, and the result is a string. Putting that string inside double quotes then causes an error because the double quotes aren't required.
FYI, you only needed the CHR(34) before because you were comparing text strings ("M"="M" is true, but M=M makes Excel think M is a variable of some kind). Here you are are comparing numbers, so you wouldn't need the CHR(34).
Regards,
Rory