Delete worksheet using VBA

Deleting a worksheet using VBA can be simple...

Dim ws As Worksheet: Set ws =

The problem with this code is that the process gets interupted by a confirmation prompt, which may not be what you want.

delete worksheet confirmation prompt

Delete worksheet without confirmation prompt

The code below uses Application.DisplayAlerts = False to prevent the warning. Don't forget to set DisplayAlerts to True again.

Dim ws As Worksheet: Set ws = 'Comment
Application.DisplayAlerts = False
Application.DisplayAlerts = True