Well, the first I would do is order the code correctly... right now your collision detection section beyond the main loop of the movement code entirely! The creation used looks good though, but you can only have one DO..LOOP and get the thing to work. Move the cube creation and detection setup stuff up to the top, and move the detection code itself from the second DO-LOOP into your main movement loop.
Computers are funny; they only do what you tell them to do in the
exact order you tell them. By having the detection outside the movement loop, you never have told it to check for it.
S.
[edit

Oh yes, and DO NOT make the change suggested by Powersoft. (Sorry Powersoft.)
Any truly great code should be indisguishable from magic.