PC Review


Reply
Thread Tools Rate Thread

Delete Worksheets in same excel

 
 
Raj
Guest
Posts: n/a
 
      12th Jul 2007
Hi all,

I am deleting some sheets of my excel worrk book after doing
certain manipulations... I'm using the followin code to delete the
sheets...


Sheets(Array("Sheet 1", "Sheet 2").Select
ActiveWindow.SelectedSheets.Delete

but when this command gets executed it ask the excel message asking
for confirmation on deleting the sheets from the workbook... is there
any way that i can delete the sheets withou asking for the
confirmation to delete nstead delete at an instance.....

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZSBI?=
Guest
Posts: n/a
 
      12th Jul 2007
Try

Application.displayalerts=false

Sheets(Array("Sheet 1", "Sheet 2").Select
ActiveWindow.SelectedSheets.Delete

Application.displayalerts=true

Mike

"Raj" wrote:

> Hi all,
>
> I am deleting some sheets of my excel worrk book after doing
> certain manipulations... I'm using the followin code to delete the
> sheets...
>
>
> Sheets(Array("Sheet 1", "Sheet 2").Select
> ActiveWindow.SelectedSheets.Delete
>
> but when this command gets executed it ask the excel message asking
> for confirmation on deleting the sheets from the workbook... is there
> any way that i can delete the sheets withou asking for the
> confirmation to delete nstead delete at an instance.....
>
>

 
Reply With Quote
 
IanKR
Guest
Posts: n/a
 
      12th Jul 2007
Assume that missing closing bracket is a typo?

Sheets(Array("Sheet 1", "Sheet 2")).Select
....


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      13th Jul 2007
In case sheet 1 or sheet 2 doesn't exist, you may want to use multiple lines:

application.displayalerts = false
on error resume next
sheets("sheet 1").delete
sheets("sheet 2").delete
on error goto 0
application.displayalerts = true


Raj wrote:
>
> Hi all,
>
> I am deleting some sheets of my excel worrk book after doing
> certain manipulations... I'm using the followin code to delete the
> sheets...
>
> Sheets(Array("Sheet 1", "Sheet 2").Select
> ActiveWindow.SelectedSheets.Delete
>
> but when this command gets executed it ask the excel message asking
> for confirmation on deleting the sheets from the workbook... is there
> any way that i can delete the sheets withou asking for the
> confirmation to delete nstead delete at an instance.....


--

Dave Peterson
 
Reply With Quote
 
Raj
Guest
Posts: n/a
 
      16th Jul 2007
On Jul 13, 9:00 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> In case sheet 1 or sheet 2 doesn't exist, you may want to use multiple lines:
>
> application.displayalerts = false
> on error resume next
> sheets("sheet 1").delete
> sheets("sheet 2").delete
> on error goto 0
> application.displayalerts = true
>
> Raj wrote:
>
> > Hi all,

>
> > I am deleting some sheets of my excel worrk book after doing
> > certain manipulations... I'm using the followin code to delete the
> > sheets...

>
> > Sheets(Array("Sheet 1", "Sheet 2").Select
> > ActiveWindow.SelectedSheets.Delete

>
> > but when this command gets executed it ask the excel message asking
> > for confirmation on deleting the sheets from the workbook... is there
> > any way that i can delete the sheets withou asking for the
> > confirmation to delete nstead delete at an instance.....

>
> --
>
> Dave Peterson


thanks... dave...

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Excel worksheets from Access. Perry Microsoft Access Macros 5 5th Apr 2010 05:15 PM
How can I delete ALL text boxes in Excel worksheets? =?Utf-8?B?R2VuZXNpcw==?= Microsoft Excel Misc 5 12th Feb 2010 02:00 PM
SHOULDBE ABLE TO DELETE EXCEL WORKSHEETS EVEN IF NOT DOC CREATOR. =?Utf-8?B?bGUgdGFtc3Rlcg==?= Microsoft Excel Worksheet Functions 10 9th Sep 2006 08:30 PM
SHOULDBE ABLE TO DELETE EXCEL WORKSHEETS EVEN IF NOT DOC CREATOR. =?Utf-8?B?bGUgdGFtc3Rlcg==?= Microsoft Excel Worksheet Functions 0 8th Sep 2006 11:59 PM
Find & Delete Duplicates across two Excel Worksheets Lance Microsoft Excel Programming 12 14th Oct 2005 09:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:15 PM.