Quote Originally Posted by PP2005
I really don't understand how this could cause an error, since the values assigned to X and Y will always be within the range of a Word.
Check the intermediate results 20 - random(40) can go below zero, which can cause problems if you mix it with a word. It is probably something like this. Split the expression up in smaller parts, this should give a clue.