It either means you are missing an End If or you forgot to close a similar statement (e.g. For statement, Do Statement, etc.) inside an If statement and it is flagging the End If because it is waiting for the other end statement and the End if as a result appears to be in the other statement. Remember to indent your code. It is a great practice that helps to avoid such isues.