All variables used inside a UDF should be DIM'ed so that they are local to the UDF only.

All information passed back out from a UDF should be passed via the return variable (UDF name).

This way the internal workings of UDF can not interfere with the calling script, no matter what variable names were used.

Bryce