in reply to ForEach Command struggle..

I know you said that you don't want us to rewrite your code... But that's what it needs. In fact you posted this earlier as part of Stupid, yet simple, sort question and jeroenes did a fine job of starting you off with some code. You should reread it, it's a big step in the right direction.