in reply to Delete the line

Sounds you have to enhance your code by the following logic

HTH, Rata