ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Confirm deletion (https://www.excelbanter.com/excel-programming/295529-confirm-deletion.html)

dsan

Confirm deletion
 
Worksheets(1).Select
ActiveWindow.SelectedSheets.Delete

When deleting a sheet from my workbook using the above code I am asked
to confirm that I really want to do this. How can I force the macro to
delete without requiring confirmation?

Harald Staff

Confirm deletion
 
Hi

Simplify. Dont select and use their windows. Just delete Worksheets(1).

What you look for is DisplayAlerts, set it to False and it means "I know
what I'm doing so don't interrupt". Like this:

Sub Killit()
Application.DisplayAlerts = False
Worksheets(1).Delete
Application.DisplayAlerts = True
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please

"dsan" skrev i melding
om...
Worksheets(1).Select
ActiveWindow.SelectedSheets.Delete

When deleting a sheet from my workbook using the above code I am asked
to confirm that I really want to do this. How can I force the macro to
delete without requiring confirmation?





All times are GMT +1. The time now is 11:01 PM.

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