Selected Answer

By not publishing your code you have committed both of us to doing this the hard way. But since you say you are a fast learner, let's do it. Look at the basic IF statement.

```
If [Condition = True] Then
' do something
End if
```

The key to understanding is that the *Condition* is evaluated to return a boolean value, meaning, either *True* or *False*. Action is taken if the evaluation results in *True*.

Now you may argue that, in your case, there are several conditions. This is where you start going wrong. In an IF statement there can't be more than one condition. It's a matter of how you look at it or, better said, of how VBA looks at it. Take this worksheet function as an example:-

`=OR(3 <> 4, 3 < 4, 3 > 1)`

It combines 3 tests into a single expression which, in this case evaluates to *True*. In fact, *=AND(3 <> 4, 3 < 4, 3 > 1)* would also evaluate to *True*. So, let's translate this expression to VBA.

`If 3 <> 4 Or 3 < 4 Or 3 > 1 Then`

Clearly, the syntax does look like 3 conditions but VBA's If statement doesn't accept more than one. You can express that by setting parentheses.

```
If (3 <> 4 Or 3 < 4 Or 3 > 1) Then
' or even
If ((3 <> 4) Or (3 < 4) Or (3 > 1)) Then
```

When mixing *And* and *Or* conditions prentheses are essential. Remember that expressions between parentheses must be resolved before their results can be used in the larger calculation. Look for the difference in the following.

```
If 3 <> 4 Or 3 < 4 And 3 < 1 Then
and
If 3 <> 4 And (3 < 4 Or 3 < 1) Then
```

In the second example the 2nd and 3rd expressions must be resolved together while they are separate in the first. In this particular example the result will be the same but that must not necessarily be so in every case.

So, to resolve your problem, set parentheses around your expressions and examine their logic. Put a break point next to the IF statement and examine each value of each expression in the Locals window when you run the code to the break point. VBA doesn't stop execution at the *AND*. It just evaluates your expressions differently from what you expect. Expect VBA to combine all 3 or 4 evaluations you have programmed into a single boolean value.