#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 130
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: For Count, when count changes from cell to cell LenS Excel Discussion (Misc queries) 18 January 4th 07 12:53 AM
Text formatting Kace Excel Worksheet Functions 1 September 18th 06 08:28 PM
Help With Macro Code?? Neil Smith Excel Worksheet Functions 1 August 24th 06 07:40 PM
Transfer Macro code to another computer Corey Excel Discussion (Misc queries) 0 May 24th 06 11:09 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM


All times are GMT +1. The time now is 07:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"