deleting sheets without excel asking

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

I'm using this code to delete a sheet:

Sheets("START").Select
ActiveWindow.SelectedSheets.Delete

When I do this excel says there may be data on the sheet do you really want
to delete it? And then you have to click delete.
Is there a way to have it delete the sheet without having the user click
delete?

Thanks,
Phil
 
Hi Phil,
You can delete a sheet without making it active.

'Delete a sheet
Application.DisplayAlerts = False
Sheets("START").Delete
'--Activesheet.Delete
'--ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True

Worksheets in VBA Coding and in Worksheet Formulas
http://www.mvps.org/dmcritchie/excel/sheets.htm
 
try this.

Sub deletesheet()
Application.DisplayAlerts = False
Sheets("sheet10").Delete
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top