{"id":12079,"date":"2011-11-06T05:26:12","date_gmt":"2011-11-06T05:26:12","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=294"},"modified":"2017-10-08T02:23:45","modified_gmt":"2017-10-08T02:23:45","slug":"delete-sheet-in-vba-without-notification","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/","title":{"rendered":"Delete Sheet In VBA Without Notification"},"content":{"rendered":"
Dear Friends, Delete-Warning-Message<\/p><\/div> Solution:<\/strong> There is a very easy solution for this. All you need to do is – set Application.DisplayAlerts<\/span><\/strong> = <\/span>False before deleting the sheet. To know more about deleting sheets, refer these articles:<\/strong><\/p>\n Dear Friends, While automating in Excel through Excel VBA, you may want to delete or add some Worksheets. This is a very common task, which we try to do. I have already written an article where I have explained a lot about deleting worksheets using Excel VBA. In this article, I am going to teach […]<\/p>\n","protected":false},"author":45,"featured_media":14362,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1246,1674],"tags":[],"class_list":["post-12079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-macro","category-excel-macro-basics"],"yoast_head":"\n
\nWhile automating in Excel through Excel VBA, you may want to delete or add some Worksheets. This is a very common task, which we try to do. I have already written an article where I have explained a lot about deleting worksheets using Excel VBA.<\/a>
\nIn this article, I am going to teach you all about disabling the warning message while deleting a sheet using Excel VBA.
\nWhile deleting a sheet from excel workbook, you get a warning message like shown in below image. This is a built-in warning message.
\nThis warning message is shown in both the case : Either you delete a sheet manually or VBA trying to delete a sheet.<\/strong>
\n<\/a>
\nDuring VBA code execution, if you do not disable this notification, your program will wait until you press OK<\/strong> on this notification. Which is really not something you want.
\nSo, the question is how to disable this sheet delete notification using VBA<\/strong>.<\/p>\n
\nrefer the below code:<\/strong><\/p>\n\r\n
\r\nPrivate Sub DisableWarningMessage()\r\n\r\n'--- disable all types of Alerts from Excel like while deleting the Sheet etc.\r\nApplication.DisplayAlerts =False\r\n'--- Now delete the particular Sheet\r\nWorksheets(\"Sheet2\").delete\r\n'--- Again enable the alerts\r\nApplication.DisplayAlerts = True\r\nEnd Sub\r\n<\/code>\r\n<\/code><\/pre>\n
<\/i> VBA To delete First sheet of the workbook irrespective of its name<\/a><\/h2>\n
<\/i> VBA to delete the last sheet of the workbook<\/a><\/h2>\n
<\/i> VBA to delete the ActiveSheet<\/a><\/h2>\n
<\/i> VBA to delete a sheet with a specific name in a Workbook<\/a><\/h2>\n
<\/i> VBA to Check if a Specific Sheet exists in a Workbook<\/a><\/h2>\n
<\/i> VBA to delete multiple sheets from a Workbook<\/a><\/h2>\n
<\/i> VBA to delete Sheet without Warning Message<\/a><\/h2>\n<\/div>\n<\/div>\n<\/span>","protected":false},"excerpt":{"rendered":"