Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Evaluate Function and Chr(34) in excel vba

Posted on 2007-03-20
5
Medium Priority
?
821 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

636 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