Question: I'm trying to use the following vba code to check for **negative values** in the row 1 of an Excel Worksheet with the numbers `1, 2, -3, 4, 5, 6`. The macro should select the `-3` value and stop there. Unfortunately it doesn't work. An error occurs telling me `End If without block If`. Can't see my mistake.

```
Sub SelectNegativeValue()
    Dim Cell As Range

    For Each Cell In Range("1:1")
        If Cell.Value < 0 Then Cell.Select
            Exit For
        End If
    Next Cell
End Sub

```

Answer: 
> 
> The macro should select the "-3" value and stop there.
> 
> 
> 

You need to move `Cell.Select` to the next line... just before `Exit For`

```
Dim Cell As Range
For Each Cell In Range("1:1")
    If Cell.Value < 0 Then
        Cell.Select
        Exit For
    End If
Next Cell

```
Learn to indent your code correctly and you will see your errors.

If you have an `If` statement that has code after `Then` in the same line, that means it is a single line `If` statement which is not allowed to have an `End If`.

`End If` is for multi line `If` statements which are not allowed to have code after `Then` in the same line:

```
Sub SelectNegativeValue()
    Dim Cell As Range
    For Each Cell In Range("1:1")
        If Cell.Value < 0 Then 
            Cell.Select
            Exit For
        End If
    Next Cell
End Sub

```