a very easy question: considering an If...Then...Else
instruction in VBA, how can I separate multiple instructions after Then
? In other words, should I write something like
If condition [ Then ]
[ statement1 ] & [statement2]
Else [Else statement] (i.e. using "&"),
or
If condition [ Then ]
[ statement1 ] And [statement2]
Else [Else statement] (i.e. using "And"),
or some other separator/command?
This question is related to
vba
if-statement
conditional-statements
This works with multiple statements:
if condition1 Then stmt1:stmt2 Else if condition2 Then stmt3:stmt4 Else stmt5:stmt6
Or you can split it over multiple lines:
if condition1 Then stmt1:stmt2
Else if condition2 Then stmt3:stmt4
Else stmt5:stmt6
Source: Stackoverflow.com