Solved

Evaluate Function and Chr(34) in excel vba

Posted on 2007-03-20
5
751 Views
Last Modified: 2012-08-13
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
Comment
Question by:tiehaze
  • 2
  • 2
5 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 18757894
Why are you using Evaluate at all? Why not:
If InStr(1, r.Offset(0, VarA1).Value, VarC1) > 0 Then 'run code a
0
 

Author Comment

by:tiehaze
ID: 18757931
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
 

Author Comment

by:tiehaze
ID: 18757939
nevermind, you are correct. thanks
0
 
LVL 81

Expert Comment

by:byundt
ID: 18757958
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
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 18757967
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now