waltr is correct. If a statement follows a “then” in an if statement, the if statement is complete; no “end if” required. If you want more than one statement to follow an if test, then each must follow on a separate line terminated by a final “end if”, but nothing can follow the “then” in that case.