Having trouble with a FOR loop.

Hi J-M-L, sorry for the long delay in a answering but I have been trying your suggestion.
You are very kind to help me but my knowledge is just not enough to follow your suggestion.
I think I am going to eave the problem for a bit, it is far more complicated than I ever imagined.
When I think through the logic thought I see now that it is complex. many thanks again for your kind efforts.