ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting sheets (https://www.excelbanter.com/excel-programming/357691-deleting-sheets.html)

Brian Matlack[_61_]

Deleting sheets
 

Hi!
Before ending my macro I delete these two sheets but Excel gives me a
warning prompt before deleting the sheets that I must OK. Is there a
way to avoid the prompt and delete the sheets without interrupting the
code?

<start code
Sheets("sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
<end code

Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=528630


Chip Pearson

Deleting sheets
 
You can use the Application.DisplayAlerts property to suppress
the message. E.g.,


Application.DisplayAlerts = False
' your code here
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brian Matlack"

wrote in message
news:Brian.Matlack.25jokc_1143826502.0397@excelfor um-nospam.com...

Hi!
Before ending my macro I delete these two sheets but Excel
gives me a
warning prompt before deleting the sheets that I must OK. Is
there a
way to avoid the prompt and delete the sheets without
interrupting the
code?

<start code
Sheets("sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
<end code

Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile:
http://www.excelforum.com/member.php...fo&userid=3508
View this thread:
http://www.excelforum.com/showthread...hreadid=528630




Brian Matlack[_62_]

Deleting sheets
 

Chip Pearson Wrote:
You can use the Application.DisplayAlerts property to suppress
the message. E.g.,


Application.DisplayAlerts = False
' your code here
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brian Matlack"

wrote in message
news:Brian.Matlack.25jokc_1143826502.0397@excelfor um-nospam.com...

Hi!
Before ending my macro I delete these two sheets but Excel
gives me a
warning prompt before deleting the sheets that I must OK. Is
there a
way to avoid the prompt and delete the sheets without
interrupting the
code?

<start code
Sheets("sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
<end code

Thanks!!


--
Brian Matlack


------------------------------------------------------------------------
Brian Matlack's Profile:
http://www.excelforum.com/member.php...fo&userid=3508
View this thread:
http://www.excelforum.com/showthread...hreadid=528630

Thanks Chip!!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=52863


Bob Phillips[_6_]

Deleting sheets
 
Application.DisplayAlerts = False

set back to True at the end.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Brian Matlack"
wrote in message
news:Brian.Matlack.25jokc_1143826502.0397@excelfor um-nospam.com...

Hi!
Before ending my macro I delete these two sheets but Excel gives me a
warning prompt before deleting the sheets that I must OK. Is there a
way to avoid the prompt and delete the sheets without interrupting the
code?

<start code
Sheets("sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
<end code

Thanks!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile:

http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=528630





All times are GMT +1. The time now is 01:14 AM.

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