22. VBA Tips - Pause Code

This VBA tip is about how to pause code.
- There are many reasons why you might want to pause code:
- You might be waiting for a file to arrive and need to pause before rechecking
- Maybe you've launched a batch file and it needs 3 seconds to run before you can continue
This is the code we'll use for this tip:
Explanation
- We recreate a new time using the TimeSerial function
- The inputs are: hour, minute and second
- We retrieve the current hour, minute and second, then add a certain amount of seconds that we pick up from the spreadhseet (for demo purposes)
- We then ask the application to wait until the time we input
- Download the practise sheet, and press the button for a demo
- You can change the time to wait as long or as little as you want down to 1 second
Download sheet to practise how to Pause Code in Excel
Training Video on how to Pause Code in Excel:
| Attachment | Size |
|---|---|
| pause-code.xls | 848.5 KB |
»
- Nick's blog
- Add new comment
- 3435 reads

Recent comments
15 min 12 sec ago
17 hours 22 min ago
17 hours 29 min ago
1 day 39 min ago
1 day 3 hours ago
1 day 19 hours ago
1 day 20 hours ago
1 day 20 hours ago
1 day 21 hours ago
1 day 21 hours ago