magicalclick


Hello guys,

I just need a quick answer to comfirm the AND/OR behavior. Some languages stop evaluate the condition is the condition is already met, like is False AND Null will give you False, and True OR Null will give you True. Instead of doing that, it seems like VBA will evaluate the full statement. Like False AND Null = Error. Is this correct

Thank you.




Re: VBA Excel, AND/OR condition behavior.

duck thing


Correct. VBA evaluates both expressions and then tries to determine whether or not the logical result is TRUE or FALSE. Since True/False==Null is undefined, you'll get an error every time. If it's possible that the value you're comparing against could ever be null, check for that beforehand. Hope this helps.






Re: VBA Excel, AND/OR condition behavior.

magicalclick

Ok, thanks. I was hopeing to ignore the null value if the condition can be evaluated before accessing null value. Looks like VBA is more strict on this at expense of performance.