TJLD22
TJLD22

Reputation: 145

Automatically choose delete worksheet without message popping up

I wrote vba code to delete a sheet permanently. When i run it, comes up with the following message:

"Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press Delete."

How can i write this code so that it deletes the worksheet automatically without the message popping up?

ThisWorkbook.Sheets("SVT").Delete

Upvotes: 2

Views: 7522

Answers (1)

assylias
assylias

Reputation: 328785

You can use:

Application.DisplayAlerts = False
ThisWorkbook.Sheets("SVT").Delete
Application.DisplayAlerts = True

Upvotes: 5

Related Questions