excel - How are `IF` and `AND` statements evaluated in VBA? -


in java or c#, and statements evaluated left right. if first condition not true, second condition not evaluated. useful if second condition cause java.lang.arrayindexoutofboundsexception.

i have similar case in excel-vba application. have if statement such:

if condition1 = false , cellelement - 1 <> "" then ...

it throws vba - run time error 1004 'application defined or object defined error', if condition1 false.

my question is, vba evaluate second condition in , statement, if first condition false?

my current work around ugly, works:

dim b boolean if condition1 = false    b = false else    b = cellelement - 1 <> ""  if b then... 

thank you!


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -