Thanks Howard, it helps to see a complete example. I can really see how the script is structured with the function in it.

I should also mention that your site is in my bookmarks now too! It's quite handy with the page containing all of the UDF's.