Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Delete Sheet without Warning

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sloth - 24 Jan 2008 20:53 GMT
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
Bob Flanagan - 24 Jan 2008 21:00 GMT
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

> 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
PCLIVE - 24 Jan 2008 21:00 GMT
Try this:

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

HTH,
Paul

> 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
Kevin B - 24 Jan 2008 21:04 GMT
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.
Signature

Kevin Backmann

> 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
Bob Flanagan - 24 Jan 2008 23:57 GMT
Kevin, you are wrong on this one.  It stays False until you turn it back to
True, even if your macro stops.

Bob

> On a line above the delete sheet statement put the following application
> command:
[quoted text clipped - 10 lines]
>>
>> Sheets("Sheet1").Delete
Gord Dibben - 24 Jan 2008 23:02 GMT
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

>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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.