See if this one fits your needs. I think it's more direct and flexible.

PinTo() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=197722&Main=197722#Post197722

See the FAQs for how to use a UDF, and the header for examples.