View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default if statements with AND or OR condition criteria

if myVar1 = "ok" _
and myVar2 = "do it now" then
'both are true
else
'at least one is false.
end if

===
and in excel, I bet you'd use:

=if(and(criteria1,criteria2), ...



philwongnz wrote:

Hi guys,

Something simple but I can't get the syntax right IN VBA. I would like
to have an IF statement in which it will test two values at ONCE. Rather
then have an IF statement to test one value and another IF statement to
test another value inside the first IF statement.

I know that I can do it in Java, but I just can't do it in VBA, even in
Excel - you can use the AND(if(criteria), if(criteria)).

Pls help.

--
philwongnz
------------------------------------------------------------------------
philwongnz's Profile: http://www.excelforum.com/member.php...o&userid=26283
View this thread: http://www.excelforum.com/showthread...hreadid=399296


--

Dave Peterson