ridding of the delete sheet confirmation in VBA

jsolomon

Board Regular
Joined
Mar 25, 2005
Messages
109
Hi all!
Here's my code:

If Left(ws.Name, 5) = "Sheet" Then
ws.Delete

Problem is it it asks if i'm sure if i want to delete the worksheet whenever i run the code. How do i get rid of that confirmation so that it just deletes it without asking if I am sure?
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
application.displayalerts = false
ws.delete
application.displayalerts = true
 

Watch MrExcel Video

Forum statistics

Threads
1,118,812
Messages
5,574,457
Members
412,595
Latest member
slim313
Top