Do you have an example patch? I don't understand fully what you want to achieve. I guess you want to build a logical loop - so you have to use the Frame Delay node to reconnect to the counter node. But I would avoid the Frame Delay node as long as you can. So maybe you can only select slices which are set by the user and cycle these slices. To select these slices you can use the = and select node.
Also, I would reset the counter node by using the change + or spectral node to look if your spread has changed.
To stop the counter at the last Slice you can set the max count with the Count node, and set the count mode to Clamp.
In the patch are 2 other examples - I hope one solution will fit.
SelectFolder.v4p (42.7 KB)