help needed on bit of code, please, anyone????

I've merged these two threads so that people who have taken the time and effort to reply don't feel they've wasted their time.