Don't think it's the UDF. The 'out of bound' error would only happen if the array would have at most one element, thus $e[0].

You might want to step throught he code via DEBUG N to figure out what exactly is going on.
_________________________
There are two types of vessels, submarines and targets.