Tried to change as advised - problem still exists ...:
Of course it will, we have not got over the silly mistakes you are making. You have to do that first before we can begin to sort out your logic.
PLEASE PLEASE PLEASE STOP creating variables inside loops.