Thread: deleting sheets
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
greg greg is offline
external usenet poster
 
Posts: 59
Default deleting sheets

THANKS EVERYONE!!!!!!!!!!!!



"greg" wrote in message
...
ok,
I am trying to delete all the sheets in a workbook.
I started with something like this:


Sub xxx()
Dim y As Excel.Worksheet
For x = 1 To Excel.ActiveWorkbook.Worksheets.Count
Set y = Excel.ActiveWorkbook.Worksheets(1)
y.Delete
Next x
End Sub


2 problems.
When you delete the sheet, you get a prompt. Is there a way to turn that
prompt off?

I guess I need at least 1 sheet. Is there a way to add a new sheet to the
end of the list of sheets. Then go
For x = 1 To Excel.ActiveWorkbook.Worksheets.Count -1

thanks on any help