ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA to sidestep popups... (https://www.excelbanter.com/excel-worksheet-functions/260484-vba-sidestep-popups.html)

Colin Hayes

VBA to sidestep popups...
 

Hi All

As part of a macro , I use this command :

ActiveWindow.SelectedSheets.Delete

On each occasion I run it , I get a popup which ask me if I really want
to delete the relevant sheet. This brings the whole macro to a halt.

Is there a command I can use to avoid the popup , and have the macro
perform the deletion without stopping the whole routine?

Grateful for any help.



Best Wishes

Dave Peterson

VBA to sidestep popups...
 
Application.displayalerts = false
'your code here
application.displayalerts = true



Colin Hayes wrote:

Hi All

As part of a macro , I use this command :

ActiveWindow.SelectedSheets.Delete

On each occasion I run it , I get a popup which ask me if I really want
to delete the relevant sheet. This brings the whole macro to a halt.

Is there a command I can use to avoid the popup , and have the macro
perform the deletion without stopping the whole routine?

Grateful for any help.

Best Wishes


--

Dave Peterson

Rick Rothstein

VBA to sidestep popups...
 
Try it this way...

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

--
Rick (MVP - Excel)



"Colin Hayes" wrote in message
...

Hi All

As part of a macro , I use this command :

ActiveWindow.SelectedSheets.Delete

On each occasion I run it , I get a popup which ask me if I really want to
delete the relevant sheet. This brings the whole macro to a halt.

Is there a command I can use to avoid the popup , and have the macro
perform the deletion without stopping the whole routine?

Grateful for any help.



Best Wishes



Jim Thomlinson

VBA to sidestep popups...
 
application.dispayalerts = false
ActiveWindow.SelectedSheets.Delete
application.displayalerts = true
--
HTH...

Jim Thomlinson


"Colin Hayes" wrote:


Hi All

As part of a macro , I use this command :

ActiveWindow.SelectedSheets.Delete

On each occasion I run it , I get a popup which ask me if I really want
to delete the relevant sheet. This brings the whole macro to a halt.

Is there a command I can use to avoid the popup , and have the macro
perform the deletion without stopping the whole routine?

Grateful for any help.



Best Wishes
.


Colin Hayes

VBA to sidestep popups...
 
In article , Rick Rothstein
writes
Try it this way...

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



Hi All

OK Thanks for the suggestions - that's fixed it. No more popup.

Thanks.



All times are GMT +1. The time now is 02:44 AM.

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