'Use sleep function but allow for input to end macro?

i have a macro that loops and uses the sleep function for a random interval between 5 seconds and 120 seconds after each loop. When the macro goes to sleep after carrying operations i am unable to end the macro without resorting to using control break where control break seems to work intermittently. So my question is this. How would i go about putting the macro to sleep for any amount of time but to also be able to terminate the macro at any time during sleep without control break?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source