Stu

That's a worksheet formula, it could be converted to VBA but if you want to keep the data on multilines I'm not sure it's a good idea.

Could you upload a sample workbook?