Delete Sheet without the confirmation

LoriD

Board Regular
Joined
Apr 1, 2002
Messages
143
I have recorded a macro that I want to run and delete Sheet1 when complete. I am getting the "Are you sure you eant to delete?" message which I have to confirm with Yes or No.
Is there some code I can insert into this macro so that message doesn't pop up, or is invisible to the user?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Russell Hauf

MrExcel MVP
Joined
Feb 10, 2002
Messages
1,611
Try this:

Application.DisplayAlerts = False
Worksheets("Sheet1").Delete
Application.DisplayAlters = True

HTH,

Russell
 

Forum statistics

Threads
1,181,994
Messages
5,933,158
Members
436,882
Latest member
Kiddo456

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top