14. VBA Tips - Turn Off Message Boxes Whilst Running Code
There are certain message boxes that will popup by default when you're running code.
- An example of this is the alert that asks you if you are sure you want to delete a sheet
- If you don't want these alerts to pop up when you're running code, you can turn them off
- Use: Application.DisplayAlerts = false at the beginning of the code
- Don't forget to turn them back on at all exit points of the code otherwise you might permanently delete a sheet by accident
- To turn them back on, use: Application.DisplayAlerts = true
Here's a screen shot of our code:
The first sub will run displaying the message box, the second one will not.
Download sheet to practise how to Turn Off Message Boxes Whilst Running Code in Excel
Training Video on how to Turn Off Message Boxes Whilst Running Code in Excel:
Attachment | Size |
---|---|
turn-off-message-boxes-whilst-running-code.xls | 35 KB |
»
- Nick's blog
- Login or register to post comments
- 91552 reads
This code is good
Thanks for your support. The code really worked for me.
Simillar issue is not being solved.
I have followed the same code, but the issue for my worksheet has not been resolved. Can anyone help me.