Macro code

G

Guest

In a macro I have, I first clear the data then delete a worksheet named
Decision and the macro stops and asks for user input by displaying a dialog
box that asks for a response with an OK via mouse click on the DELETE button
or a CANCEL.

Is there code that will press the DELETE button automatically and avoid the
stoppage?

Here is the code that exist currently.

Sheets("Decision").Select
Application.CutCopyMode = False
Cells.Select
Selection.Clear
ActiveWindow.SelectedSheets.Delete

Thank you
 
D

Dave Peterson

Drop the clearing stuff.

application.displayalerts = false
ActiveWindow.SelectedSheets.Delete
application.displayalerts = true

Remember that the workbook has to have at least one visible sheet.
 
G

Gord Dibben

Shu

Selection.Clear
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True



Gord Dibben MS Excel MVP
 

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

Top