Hi Thanks this was very helpfull. Your final solution seems like the best (most elegant). I was trying to avoid the ugly while loops with breaks and this final one certainly does that. Thanks for your help .