Reputation: 943
I'm using Application.Sheets("Sheet6").Delete
to delete a sheet, and it causes a popup that asks if I'm sure. How do I automatically select delete?
Upvotes: 0
Views: 98
Reputation: 6826
Turn off the alerts before you do the delete. Then turn them back on like this:
Application.DisplayAlerts = False
Application.Sheets("Sheet6").Delete
Application.DisplayAlerts = True
Upvotes: 1
Reputation: 394
You can turn your display alerts off for Excel
Application.DisplayAlerts = False
Application.Sheets("Sheet6").Delete
Application.DisplayAlerts = True
Upvotes: 1
Reputation: 2087
Update your code to disable the display of alerts before you delete your sheet; Then enable the alerts after the delete code executes
Application.DisplayAlerts = False
Sheets("Sheet6").Delete
Application.DisplayAlerts = True
Upvotes: 4