Macro code

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Shu

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



Gord Dibben MS Excel MVP
 
Back
Top