How to delete Excel worksheet using VBA without delete dialog?
In my VBA macro, I delete a worksheet. A dialog displays asking if I really
want to delete the worksheet. The answer is always yes therefore I do not want the user to have to click the Delete button so the macro can continue. Is there any way to turn off this "feature"? |
How to delete Excel worksheet using VBA without delete dialog?
Hi cocalico22
You can use DisplayAlerts Sub DeleteActiveSheet() Application.DisplayAlerts = False ActiveSheet.Delete Application.DisplayAlerts = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "cocalico22" wrote in message ... In my VBA macro, I delete a worksheet. A dialog displays asking if I really want to delete the worksheet. The answer is always yes therefore I do not want the user to have to click the Delete button so the macro can continue. Is there any way to turn off this "feature"? |
How to delete Excel worksheet using VBA without delete dialog?
application.displayalerts = false
'delete the sheet code here application.displayalerts = true cocalico22 wrote: In my VBA macro, I delete a worksheet. A dialog displays asking if I really want to delete the worksheet. The answer is always yes therefore I do not want the user to have to click the Delete button so the macro can continue. Is there any way to turn off this "feature"? -- Dave Peterson |
How to delete Excel worksheet using VBA without delete dialog?
Application.DisplayAlerts = False
Worksheets("Sheet1").Delete Application.DisplayAlerts = True -- Charles Chickering "A good example is twice the value of good advice." "cocalico22" wrote: In my VBA macro, I delete a worksheet. A dialog displays asking if I really want to delete the worksheet. The answer is always yes therefore I do not want the user to have to click the Delete button so the macro can continue. Is there any way to turn off this "feature"? |
How to delete Excel worksheet using VBA without delete dialog?
put this line in front of your group of code that deletes the worksheet
Application.DisplayAlerts = False then put this after Application.DisplayAlerts = True I think that should take care of it. "cocalico22" wrote: In my VBA macro, I delete a worksheet. A dialog displays asking if I really want to delete the worksheet. The answer is always yes therefore I do not want the user to have to click the Delete button so the macro can continue. Is there any way to turn off this "feature"? |
All times are GMT +1. The time now is 09:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com