View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete sheet without prompt

Hi chad

Application.DisplayAlerts = False
'delete code
Application.DisplayAlerts = True


This example will not give a error if it exist

On Error Resume Next
Sheets("Sheet1").Name = "Import"
On Error GoTo 0



--
Regards Ron de Bruin
http://www.rondebruin.nl


"chad" wrote in message ...
How can I delete a sheet without a message box prompting for the user to confirm the deletion of the sheet? Also, is there a way

to rename a sheet without it defaulting to "sheet1" or the next number? In other words, if "sheet1" already exists when I add a new
sheet it will default to "sheet2" and the following code will generatte an error.

Sheets("Import").Select
ActiveWindow.SelectedSheets.Delete
Sheets.Add
Sheets("Sheet1").Name = "Import"

Thanks