delete modules and sheets

  • Thread starter Thread starter mike allen
  • Start date Start date
M

mike allen

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
 
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
 
Back
Top