• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 834
  • Last Modified:

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

0
tiehaze
Asked:
tiehaze
  • 2
  • 2
1 Solution
 
byundtCommented:
Why are you using Evaluate at all? Why not:
If InStr(1, r.Offset(0, VarA1).Value, VarC1) > 0 Then 'run code a
0
 
tiehazeAuthor Commented:
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.
0
 
tiehazeAuthor Commented:
nevermind, you are correct. thanks
0
 
byundtCommented:
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.
0
 
Rory ArchibaldCommented:
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
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now