Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy VBA question....please

Status
Not open for further replies.

jjokol

Technical User
Dec 18, 2008
5
GB
What's the correct way of asking VBA to evaluate 2 conditions so that they're both true? In the example below, I want 2 conditions to be met before it proceeds:

If Range("C3").Value > 2* Range("C1").Value AND Range("C3").Value > 11.1 then...


Condition 1 = Range("C3").Value > 2* Range("C1").Value
Condition 2 = Range("C3").Value > 11.1

I've put a AND in but VBA doesn't like it.
 
YOu could try

If [red]([/red]Range("C3").Value > 2* Range("C1").Value[red])[/red] AND [red]([/red]Range("C3").Value > 11.1[red])[/red] then...


Parens almost always help in these situations.
 
but VBA doesn't like it
Could you elaborate on this ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
[tab]-> but VBA doesn't like it
That's not very descriptive. What error do you get? What is in cells C1 and C3?

Assuming you have numbers in those cells, it should work as you have it written.

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top