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
- Login or register to post comments
- 22431 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago