Solved

Evaluate Function and Chr(34) in excel vba

Posted on 2007-03-20
5
746 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 80

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 80

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

758 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