How do I reverse through frames?

Can someone tell me how I reverse through frames.

I can certanly have a loop that calls prevframe.
But, what I want is to know when I have reached a certain frame.
The only way I can think of how to do this is to know the exact number of frames, and then use a loop that loops the exact number of frames I need.

Any help would be appreciated.

Thanks.

OM