Thanks for that, nicknameoscar. I know I can code around the problem, but as you rightly say it leads to rather bulky code. I'm afraid I've taken the coward's way out and opted for simpler code but losing a little functionality. I'm conscious that it won't be me maintaining this code in the future (I'm doing a favour for a voluntary organisation) so I don't want there to be anything too complicated in it. Thanks for your contribution, though - I've filed your code in my 'handy stuff' folder.