Your IF..Then's are causing you to jump out of the for...next. If you change the GOTO to GOSUB, then add a RETURN after the blocks of code you are jumping to, maybe this will fix the problem.

I must admit I don't really get the goal of your program, but I think you don't intend to jump out maybe?