The indentation suggests that you are mixing up the two kinds of If statement.
The block version has the form
The single-line version does not have End If, it ends at the end of the line.
Note the word Then is optional.
The block version has the form
If condition ; A block of statements ; goes here End If
The single-line version does not have End If, it ends at the end of the line.
If condition Then statement1 : statement2 : etc. ; and it ends here.
Note the word Then is optional.