Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am running a simple macro where I need to delete a worksheet named
"Pivot", using the following code in VBA: Sheets("Pivot").Delete However, when I run this, I get a dialog box within Excel that reads: "Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press delete" The dialog box has two buttons "Delete" (which is active) and "Cancel". Is there a way that I can automate the pressing of the delete button so that the end user doesn't have to respond to the dialog box? Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set the DisplayAlerts to False before you do the delete, then restore it to
true after the delete. E.g., Application.DisplayAlerts = False Sheets("Pivot").Delete Application.DisplayAlerts = True -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "Scott G" wrote in message oups.com... I am running a simple macro where I need to delete a worksheet named "Pivot", using the following code in VBA: Sheets("Pivot").Delete However, when I run this, I get a dialog box within Excel that reads: "Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press delete" The dialog box has two buttons "Delete" (which is active) and "Cancel". Is there a way that I can automate the pressing of the delete button so that the end user doesn't have to respond to the dialog box? Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Chip, that worked perfectly!
Chip Pearson wrote: Set the DisplayAlerts to False before you do the delete, then restore it to true after the delete. E.g., Application.DisplayAlerts = False Sheets("Pivot").Delete Application.DisplayAlerts = True -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "Scott G" wrote in message oups.com... I am running a simple macro where I need to delete a worksheet named "Pivot", using the following code in VBA: Sheets("Pivot").Delete However, when I run this, I get a dialog box within Excel that reads: "Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press delete" The dialog box has two buttons "Delete" (which is active) and "Cancel". Is there a way that I can automate the pressing of the delete button so that the end user doesn't have to respond to the dialog box? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Slow Respone to key strokes | Excel Discussion (Misc queries) | |||
Slow respone to key strokes | Excel Discussion (Misc queries) | |||
Is there a way to move between worksheets using key strokes only? | Excel Discussion (Misc queries) | |||
How do I repeat key strokes in Excel? | Excel Programming | |||
How can I activate a combobox by keyboard strokes ? | Excel Programming |