Auto delete of a sheet

W

Wendell A. Clark

I recorded the following code to delete a particular worksheet

Sheets("Temp").Select
ActiveWindow.SelectedSheets.Delete

My question is how do I suppress the confirmation dialogue?

ANy hel p would be most welcome and thanks ;-)

--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.
 
R

Ron de Bruin

Hi Wendell

Use

Application.DisplayAlerts = False
'your code
Application.DisplayAlerts = True
 
N

Nate Oliver

Hello Wendell,

You're not the Leafs former power forward are you? Best wrist-shot
ever!

You'll want to toggle the Application's 'alerts' setting for this,
e.g.,

Sub foo()
Application.DisplayAlerts = False
On Error Resume Next ' In case it's not there
ThisWorkbook.Worksheets("Temp").Delete
On Error GoTo 0
Application.DisplayAlerts = True
End Sub

Regards,
Nate Oliver
 
W

Wendell A. Clark

Awesome thanks---

--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Setting a criteria in an AdvancedFilter macro 3
Numbers to Words 2
Outlook using statements 1
Encapsulating data 4
Barcode 7
Backing up Contacts 3
2003 to 97 2
2007 to 2003 3

Top