View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Error Trapping Question

I get a message asking the following:

Data may exist in the sheet(s) selected for deletion. To permanently delete
the data, select DELETE.

How do I delete the sheet without this message?


"Tushar Mehta" wrote:

Use the untested

Sub DeleteSheet()
On Error Resume Next
Sheets("Sheet1").Delete
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I have this simple macro

Sub DeleteSheet()
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
End Sub

How should I modify it so that if Sheet1 isn't present, it'll just move on.
I'll want to add more to this at a later time, so Exit Sub may not
necessarily be an option.