basic macro question

I'm trying to add 2 new optional fields to about 4000 standing orders, because Sage does not auto-insert opt fields when activating from a Standing Order.  I have a macro that works for one, or when I "mailmerge" to repeat the code for a certain number of orders, but I don't know how to make it loop.  Essentially I want to start with one order#, which I can hard code in the macro, and then loop through till it's done.  How do you tell it to move on to the next order, and stop when there are no more Standing Orders? (Standing orders: OEORDH.TYPE = 3)

thanks in advance for a newbie question from a seriously oldtimer.