Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting sheets TK[_3_] Excel Programming 2 August 31st 05 06:02 AM
deleting sheets 2&3 doug53098 Excel Discussion (Misc queries) 2 July 7th 05 08:22 PM
Deleting Sheets ExcelMonkey[_190_] Excel Programming 1 March 25th 05 10:02 AM
deleting sheets KLP Excel Discussion (Misc queries) 3 January 14th 05 12:24 AM
Deleting sheets Gary Adamson[_2_] Excel Programming 2 October 30th 03 07:24 PM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"