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

Re: deleting sheets without excel asking by David

David
Sun Nov 27 00:23:05 CST 2005

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
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Phil" <phil2005@buddy.com> wrote in message news:uiwG%23Tx8FHA.2176@TK2MSFTNGP14.phx.gbl...
> 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
>
>



Re: deleting sheets without excel asking by Don

Don
Sun Nov 27 06:30:11 CST 2005

try this.

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

--
Don Guillett
SalesAid Software
donaldb@281.com
"Phil" <phil2005@buddy.com> wrote in message
news:uiwG%23Tx8FHA.2176@TK2MSFTNGP14.phx.gbl...
> 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
>