Super basic... How to get servo to stop sweeping

Hello,
I apologize in advance for how basic this is, but Google couldn't find me a solution. Here we go:

I have an arduino Uno. I am running two servos off it. They are triggered with a button. I'd like them to each sweep three times and then stop until the button is pressed again.

Right now, when I press the button they sweep over and over until I press it again. I want them to stop on their own. I know there is a simple answer out there but I can't figure it out. Anyone care to divulge?

Thanks very much!

My omniscience helmet is in the repair shop so I have to use my guessing cap,

the code you failed to show has delay() in it or some kind of while (not done) { wait } loop, right?

The answer you need is likely in the first link provided at the bottom of this post.

Right now, when I press the button they sweep over and over until I press it again. I want them to stop on their own. I know there is a simple answer out there but I can't figure it out. Anyone care to divulge?

Put the servo sweep code in a function. When the button becomes depressed enter a for loop that counts from 0 to 2 and call the sweep function from inside the for loop.