I hope you get this kind of reply every time you have been of critical assistance. Thank you very much. The code worked perfectly the first time.