ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   automatically deleting a worksheet (without warning prompt) (https://www.excelbanter.com/excel-programming/387888-automatically-deleting-worksheet-without-warning-prompt.html)

Guerilla

automatically deleting a worksheet (without warning prompt)
 

Hi,

A macro I use deletes a sheet tab, however, it prompts me to confirm
the deletion of the sheet. How can I remove this prompt so the macro
runs without any user interaction?

Matt


urkec

automatically deleting a worksheet (without warning prompt)
 
I think you can use this:

Sub delSheet()

Application.DisplayAlerts = False
Application.Sheets(1).Delete

End Sub


--
urkec


"Guerilla" wrote:


Hi,

A macro I use deletes a sheet tab, however, it prompts me to confirm
the deletion of the sheet. How can I remove this prompt so the macro
runs without any user interaction?

Matt



JMay

automatically deleting a worksheet (without warning prompt)
 
Add these 2 lines to your macro:

Application.Displayalerts = False '<<<< here
worksheets("TempData").Delete
Application.Displayalerts = True ' <<< and here

HTH

"Guerilla" wrote in message
oups.com:

Hi,

A macro I use deletes a sheet tab, however, it prompts me to confirm
the deletion of the sheet. How can I remove this prompt so the macro
runs without any user interaction?

Matt



Guerilla

automatically deleting a worksheet (without warning prompt)
 

Both answers worked, thank you very much.

Matt



All times are GMT +1. The time now is 05:11 PM.

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