Got it.. thanks sabertoothe I was trying a function but couldn't get it working. I have now.
For future reference, please do not edit out your original question. It makes the thread less useful to those viewing it in the future who have no idea what the answer means.