delete modules and sheets

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
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top