(how are we supposed to help you debug your code if you don't even post the code but just the UDF itself?)

I haven't got that far yet mate! I was jumt importing the UDF and wondered what EXIT 87 does. If I do have problems debugging I will let you know.