Sorry about that. Without picking apart all your code, I would think that if you kept ontop of the $vIndex, that would do it. A DO UNTIL loop would be better than a GOTO.

I though, would take a different approach, using the ArrayEnumKey() UDF and then a FOR NEXT loop.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.