Mohammed,
please note my remarks:
But there is something wrong with your logic, I guess you will see it easier now. Your code simply can not work for all possible values, that's also why I added a few messageboxes so that you can see what runs when.
>hi,
>thank you very much,it works.
>
>
>
>best regards.
>m.qasem