ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting sheets removing/turning off the xl prompt (https://www.excelbanter.com/excel-programming/293142-deleting-sheets-removing-turning-off-xl-prompt.html)

EMMA

Deleting sheets removing/turning off the xl prompt
 
Hello

I'm building a macro which involves creating some new
worksheets, performing calcs in them, then deleting the
rough working worksheets before saving the amended file,
using the following code:

Sheets("working").Select
ActiveWindow.SelectedSheets.Delete


unfortunately this means that I have to keep an eye on the
computer while running the macro, as the prompt for
deleting the sheets comes up everytime. Very annoying when
the macro takes about 10 minutes to work on each file.

One alternative solution would be to move the rough
working sheets to another file and then kill that file,
but this seems a bit contrived. Is there a cleverer way of
getting around this problem, such as a command to turn off
the automatic prompt, or a different way of deleting the
sheet which won't require any manual input?

Cheers

Frank Kabel

Deleting sheets removing/turning off the xl prompt
 
Hi
try the following
application.DisplayAlerts = False
Sheets("working").Select
ActiveWindow.SelectedSheets.Delete
application.DisplayAlerts=True


--
Regards
Frank Kabel
Frankfurt, Germany

EMMA wrote:
Hello

I'm building a macro which involves creating some new
worksheets, performing calcs in them, then deleting the
rough working worksheets before saving the amended file,
using the following code:

Sheets("working").Select
ActiveWindow.SelectedSheets.Delete


unfortunately this means that I have to keep an eye on the
computer while running the macro, as the prompt for
deleting the sheets comes up everytime. Very annoying when
the macro takes about 10 minutes to work on each file.

One alternative solution would be to move the rough
working sheets to another file and then kill that file,
but this seems a bit contrived. Is there a cleverer way of
getting around this problem, such as a command to turn off
the automatic prompt, or a different way of deleting the
sheet which won't require any manual input?

Cheers


Jean-Yves[_2_]

Deleting sheets removing/turning off the xl prompt
 
Hi
As follows :
application.DisplayAlerts=False
Sheets("working").delete 'don't need to select the sheet before
application.DisplayAlerts=True

Regards,
Jean-Yves


"EMMA" . com wrote in
message ...
Hello

I'm building a macro which involves creating some new
worksheets, performing calcs in them, then deleting the
rough working worksheets before saving the amended file,
using the following code:

Sheets("working").Select
ActiveWindow.SelectedSheets.Delete


unfortunately this means that I have to keep an eye on the
computer while running the macro, as the prompt for
deleting the sheets comes up everytime. Very annoying when
the macro takes about 10 minutes to work on each file.

One alternative solution would be to move the rough
working sheets to another file and then kill that file,
but this seems a bit contrived. Is there a cleverer way of
getting around this problem, such as a command to turn off
the automatic prompt, or a different way of deleting the
sheet which won't require any manual input?

Cheers





All times are GMT +1. The time now is 12:43 PM.

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