A little lesson in VBA there: If statements can be used in a single line, like you do on your last two. But in such cases they can only be used to execute ONE statement. In your last two, that works fine as you are only executing an Exit Sub, a single statement.

However, if you are executing multiple statements then you need to use If statements like this:

    
    If x = y Then
        MsgBox "X = Y, well done!"
        Exit Sub
    Else
        MsgBox "X does not = Y, poor you :-("
        ActiveSheet.Protect
    End If