Thanks sktneer
the code is working fine and as required.

I would also request venkat1926 to give a sample file since there are two codes.

Thanks again

however the querry is solved but I am waiting for venkat's reply.