ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto delete of a sheet (https://www.excelbanter.com/excel-programming/361722-auto-delete-sheet.html)

Wendell A. Clark

Auto delete of a sheet
 
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.




Ron de Bruin

Auto delete of a sheet
 
Hi Wendell

Use

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



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Wendell A. Clark" wrote in message ...
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.






Nate Oliver[_4_]

Auto delete of a sheet
 
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


Wendell A. Clark

Auto delete of a sheet
 
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.


"Nate Oliver" wrote in message
oups.com...
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





All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com