ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete sheet code (https://www.excelbanter.com/excel-programming/428522-delete-sheet-code.html)

LiAD

Delete sheet code
 
Hi,

Using the VB recorder I got a code to delete a sheet that is;

Sheets("Machines").Select
ActiveWindow.SelectedSheets.delete

It runs and works. One small issue is that it asks Are you sure you want to
delete this sheet? The user must choose yes before it continues.

Can I disable the need to ask this question - once the user hits the button
it deletes, no questions?

Thanks
LiAD

Jacob Skaria

Delete sheet code
 
Application.DisplayAlerts = False
Sheets("Machines").Delete
Application.DisplayAlerts = True

If this post helps click Yes
---------------
Jacob Skaria


"LiAD" wrote:

Hi,

Using the VB recorder I got a code to delete a sheet that is;

Sheets("Machines").Select
ActiveWindow.SelectedSheets.delete

It runs and works. One small issue is that it asks Are you sure you want to
delete this sheet? The user must choose yes before it continues.

Can I disable the need to ask this question - once the user hits the button
it deletes, no questions?

Thanks
LiAD



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

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