View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default delete modules and sheets

You can use code at Chip Pearson's site to remove the modules:
http://cpearson.com/excel/vbe.htm

If sheet2 or sheet3 (or both) don't exist, then you'll have trouble.

But you can delete multiple sheets with:
Worksheets(Array("sheet2", "sheet3")).Delete

mike allen wrote:

I am having problems with a very simple routine I have done before. None of
the the three commands works in this code (1-delete modules, 2-delete
multiple sheets, 3- have no alert flash when deleting).
Sub test()
DisplayAlerts = False
Modules("module2", "module3").Delete
Sheets("sheet2", "sheet3").Delete 'I can delete one sheet at a time
DisplayAlerts = True
End Sub

Thanks, Mike Allen


--

Dave Peterson