{"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,
\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

\"Delete-Warning-Message\"<\/a>

Delete-Warning-Message<\/p><\/div>
\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

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.
\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
\nNote:<\/span><\/strong> After deleting make sure that we are again setting the<\/em> Application.DisplayAlerts<\/span> as <\/span>True<\/strong>. Otherwise, even if we are deleting any sheet from any of the Excel Sheet in your PC, no Alert will appear. So always disable it before deleting and then again enable it back after deletion.<\/em>\n<\/div>\n

To know more about deleting sheets, refer these articles:<\/strong><\/p>\n

\n
\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":"

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":"\nDeleting Sheet without warning message - To enable deletion without any notification<\/title>\n<meta name=\"description\" content=\"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Delete Sheet In VBA Without Notification\" \/>\n<meta property=\"og:description\" content=\"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-06T05:26:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-08T02:23:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"538\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"Delete Sheet In VBA Without Notification\",\"datePublished\":\"2011-11-06T05:26:12+00:00\",\"dateModified\":\"2017-10-08T02:23:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\"},\"wordCount\":328,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg\",\"articleSection\":[\"Excel Macro\",\"Excel Macro Basics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\",\"name\":\"Deleting Sheet without warning message - To enable deletion without any notification\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg\",\"datePublished\":\"2011-11-06T05:26:12+00:00\",\"dateModified\":\"2017-10-08T02:23:45+00:00\",\"description\":\"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg\",\"width\":800,\"height\":538,\"caption\":\"Delete Sheet without warning Message\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Delete Sheet In VBA Without Notification\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Deleting Sheet without warning message - To enable deletion without any notification","description":"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/","og_locale":"en_US","og_type":"article","og_title":"Delete Sheet In VBA Without Notification","og_description":"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning","og_url":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2011-11-06T05:26:12+00:00","article_modified_time":"2017-10-08T02:23:45+00:00","og_image":[{"width":800,"height":538,"url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg","type":"image\/jpeg"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"Delete Sheet In VBA Without Notification","datePublished":"2011-11-06T05:26:12+00:00","dateModified":"2017-10-08T02:23:45+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/"},"wordCount":328,"commentCount":2,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg","articleSection":["Excel Macro","Excel Macro Basics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/","url":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/","name":"Deleting Sheet without warning message - To enable deletion without any notification","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg","datePublished":"2011-11-06T05:26:12+00:00","dateModified":"2017-10-08T02:23:45+00:00","description":"Disable warning while deleting a sheet. Delete sheet in VBA without notification. VBA to Delete Sheet without any warning message. Disable delete sheet warning","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#primaryimage","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2011\/11\/Disable-Delete-Warning.jpg","width":800,"height":538,"caption":"Delete Sheet without warning Message"},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2011\/11\/delete-sheet-in-vba-without-notification\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"Delete Sheet In VBA Without Notification"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/12079"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=12079"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/12079\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media\/14362"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=12079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=12079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=12079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}