Delete Worksheets in same excel

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

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.....
 
Try

Application.displayalerts=false

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

Application.displayalerts=true

Mike
 
Assume that missing closing bracket is a typo?

Sheets(Array("Sheet 1", "Sheet 2")).Select
....
 
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
 
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

thanks... dave...
 
Back
Top