Error 347
Structures improperly matched
The FOR...NEXT, LOOP...END LOOP, REPEAT...UNTIL, SELECT...END SELECT, WHILE...END WHILE, program structures are either nested improperly or there is a missing structured statement.