ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA for deleting a sheet (https://www.excelbanter.com/excel-programming/346321-vba-deleting-sheet.html)

Mike

VBA for deleting a sheet
 
I am using the following code to delete a sheet within Excel:

ActiveWindow.SelectedSheets.Delete

Problem is, it is prompting the user to see if it is okay to delete. In
every scenario of this macro, it will be okay to delete, so how can I bypass
this message?

Norman Jones

VBA for deleting a sheet
 
Hi Mike,

Try:

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True

---
Regards,
Norman



"Mike" wrote in message
...
I am using the following code to delete a sheet within Excel:

ActiveWindow.SelectedSheets.Delete

Problem is, it is prompting the user to see if it is okay to delete. In
every scenario of this macro, it will be okay to delete, so how can I
bypass
this message?




Leith Ross[_304_]

VBA for deleting a sheet
 

Hello Mike,

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DispalyAlerts = True

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=487372


Mike

VBA for deleting a sheet
 
thanks to both of you

"Leith Ross" wrote:


Hello Mike,

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DispalyAlerts = True

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=487372




All times are GMT +1. The time now is 02:04 PM.

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