@shaneEP. That is a brilliant idea. Don't know why I didn't think of that before! Probably because I don't do coding for a living! I think that I will do this for my entire script - mainly the UDF's File as it would make it far easier to read the code as you rightly pointed out. I can now clearly see that the if else endifs are lining up. Thanks.