Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How can I delete multiple sheets in VBA...

Greetings All,

How can I delete multiple sheets in VBA without having to acknowledge the
Excel warning message for each sheet?

I wrote a VBA routine that would loop through and delete all but the first
sheet.
But I have to acknowledge the warning message for each shett.

Is there a way to select a range of sheets for deletion and only have to
acknowledge the deletion once OR can I supress the warning message?

Thanks in advance!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How can I delete multiple sheets in VBA...

Not sure exactly what you rcode looks like but this will work...

Sub DeleteSheets
dim wks as worksheet
on error goto Errorhandler
application.displayalerts = false

for each wks in worksheets
if wks.name < "Main" then wks.delete
next wks

Errorhandler:
application.displayalerts = true
end sub

--
HTH...

Jim Thomlinson


"kurt" wrote:

Greetings All,

How can I delete multiple sheets in VBA without having to acknowledge the
Excel warning message for each sheet?

I wrote a VBA routine that would loop through and delete all but the first
sheet.
But I have to acknowledge the warning message for each shett.

Is there a way to select a range of sheets for deletion and only have to
acknowledge the deletion once OR can I supress the warning message?

Thanks in advance!!!

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
Delete rows in multiple sheets without loop? MTT727 Excel Programming 2 July 26th 05 03:07 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 04:38 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:20 PM
Delete Rows from multiple Sheets. drbobsled Excel Programming 3 April 7th 05 01:23 AM


All times are GMT +1. The time now is 01:39 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"