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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -