![]() |
if statements with AND or OR condition criteria
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 |
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 |
if statements with AND or OR condition criteria
Try something like
If (criterion1) And (criterion2) Then -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "philwongnz" wrote in message ... 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 |
All times are GMT +1. The time now is 11:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com