Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Delete Sheet without Warning

how do I supress the warning when deleting a sheet with a macro? I am using
the command following command to delete the sheet.

Sheets("Sheet1").Delete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Delete Sheet without Warning

Application.DisplayAlerts = False
Sheets("Sheet1").Delete
Application.DisplayAlerts = True

Always set back to true as the property will stay false until reset.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Sloth" wrote in message
...
how do I supress the warning when deleting a sheet with a macro? I am
using
the command following command to delete the sheet.

Sheets("Sheet1").Delete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Delete Sheet without Warning

Try this:

Application.DisplayAlerts = False
Sheets("Sheet1").Delete
Application.DisplayAlerts = True


HTH,
Paul

--

"Sloth" wrote in message
...
how do I supress the warning when deleting a sheet with a macro? I am
using
the command following command to delete the sheet.

Sheets("Sheet1").Delete



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Delete Sheet without Warning

On a line above the delete sheet statement put the following application
command:

Application.DisplayAlerts = False

Alerts in Excel are automatically reactivated when the macro is finished
running so there's no need to end you macro with an
"Application.DisplayAlerts = True" statement.
--
Kevin Backmann


"Sloth" wrote:

how do I supress the warning when deleting a sheet with a macro? I am using
the command following command to delete the sheet.

Sheets("Sheet1").Delete

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Delete Sheet without Warning

Do you really need "Sheet1" hard-coded?

Maybe like this in case you want to delete more than one sheet.

Sub SheetDelete()
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 12:53:50 -0800, Sloth
wrote:

how do I supress the warning when deleting a sheet with a macro? I am using
the command following command to delete the sheet.

Sheets("Sheet1").Delete




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Delete Sheet without Warning

Kevin, you are wrong on this one. It stays False until you turn it back to
True, even if your macro stops.

Bob

"Kevin B" wrote in message
...
On a line above the delete sheet statement put the following application
command:

Application.DisplayAlerts = False

Alerts in Excel are automatically reactivated when the macro is finished
running so there's no need to end you macro with an
"Application.DisplayAlerts = True" statement.
--
Kevin Backmann


"Sloth" wrote:

how do I supress the warning when deleting a sheet with a macro? I am
using
the command following command to delete the sheet.

Sheets("Sheet1").Delete



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
Delete Sheet w/o warning prompt... Jeff Harbin[_4_] Excel Programming 6 September 9th 06 02:39 AM
How to Delete Excel Sheet without Warning - MFC [email protected] Excel Programming 5 July 24th 06 04:20 PM
VBA Bypass Delete Sheet Warning bill_morgan Excel Programming 8 February 28th 06 10:51 PM
What is the VBA code to delete a sheet without warning message? [email protected] Excel Discussion (Misc queries) 2 August 9th 05 04:16 PM
Delete sheet without warning messages Flystar[_17_] Excel Programming 1 May 31st 04 04:51 AM


All times are GMT +1. The time now is 04:23 AM.

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

About Us

"It's about Microsoft Excel"