VBA: Prevent warning messages from a macro
When writing a macro there are times when you don’t need to prompt the user with the default warning messages, like “Ok to delete sheet?”. To turn off the default warning messages, add this code to your macro.
To prevent warning messages, place this code in your macro
Application.DisplayAlerts = False
And don’t forget to turn them back on at some point in your macro
Application.DisplayAlerts = True