ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro code (https://www.excelbanter.com/excel-discussion-misc-queries/128161-macro-code.html)

Shu of AZ

Macro code
 
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

Dave Peterson

Macro code
 
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 of AZ wrote:

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


--

Dave Peterson

Gord Dibben

Macro code
 
Shu

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



Gord Dibben MS Excel MVP

On Mon, 29 Jan 2007 09:42:01 -0800, Shu of AZ
wrote:

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




All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com