{"id":8520,"date":"2016-12-13T07:17:46","date_gmt":"2016-12-13T07:17:46","guid":{"rendered":"http:\/\/www.top-password.com\/blog\/?p=8520"},"modified":"2016-12-14T02:25:25","modified_gmt":"2016-12-14T02:25:25","slug":"prevent-excel-sheet-from-being-deleted","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/prevent-excel-sheet-from-being-deleted\/","title":{"rendered":"2 Ways to Prevent Excel Sheet from Being Deleted"},"content":{"rendered":"<p>How can I protect an Excel worksheet from being deleted? Looking for a way to prevent sheets from being deleted while still allowing them to be hidden or rearranged? In this tutorial we&#8217;ll show you 2 ways to protect a particular or all sheets from being deleted in Excel 2016\/2013\/2010\/2007.<\/p>\n<p><strong>Tips:<\/strong> <em>If you want to protect an Excel file (.XLS, .XLSX) from being deleted accidentally, please try the <a href=\"http:\/\/www.top-password.com\/protect-my-folders.html\">Protect My Folders<\/a> program which can lock any folders or files with password.<br \/>\n<\/em><\/p>\n<p><strong>Method 1: Protect Entire Workbook Structure with Password<\/strong><\/p>\n<ol>\n<li>Open your Excel workbook. Select &#8220;<strong>Review<\/strong>&#8221; Ribbon menu and click &#8220;<strong>Protect Workbook<\/strong>&#8221; from the changes group.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/protect-workbook.png\" alt=\"protect-workbook\" width=\"599\" height=\"329\" class=\"alignnone size-full wp-image-8522\" \/><\/p>\n<\/li>\n<li>A Protect Structure and Window dialog box opens. Make sure the <strong>Structure<\/strong> option is checked. Type your password and click <strong>OK<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/images\/password-protect-workbook-structure.png\" width=\"223\" height=\"203\" class=\"alignnone\" \/><\/p>\n<\/li>\n<li>Reenter the password and click <strong>OK<\/strong>.<\/li>\n<li>Now all your sheets in the workbook are protected. You cannot insert, delete, rename, move, copy, hide or unhide worksheets anymore.<\/li>\n<\/ol>\n<p><strong>Method 2: Protect A Particular Sheet from Being Deleted Using VBA<\/strong><\/p>\n<p>If you just want to prevent users from deleting a particular sheet you designate, try this solution. This works flawlessly for me on a test workbook in Excel 2016.<\/p>\n<ol>\n<li>Right-click on any sheet tab and select <strong>View Code<\/strong> from the popup menu. This will open the Visual Basic Editor (ALT+F11).\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/sheet-view-code.png\" alt=\"sheet-view-code\" width=\"563\" height=\"337\" class=\"alignnone size-full wp-image-8523\" \/><\/p>\n<\/li>\n<li>You&#8217;ll see a list of worksheets on the left. Double-click on every sheet you want to protect from being deleted, copy and paste the following code into the large white area on the right.\n<p><code>Private Sub Worksheet_Deactivate()<br \/>\nThisWorkbook.Protect , True<br \/>\nApplication.OnTime Now, \"UnprotectBook\"<br \/>\nEnd Sub<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/sheet-vba-code.png\" alt=\"sheet-vba-code\" width=\"587\" height=\"272\" class=\"alignnone size-full wp-image-8524\" \/><\/p>\n<\/li>\n<li>Right-click on <strong>Microsoft Excel Objects<\/strong> on the left, select <strong>Insert<\/strong> -&gt; <strong>Module<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/insert-excel-module.png\" alt=\"insert-excel-module\" width=\"587\" height=\"382\" class=\"alignnone size-full wp-image-8525\" \/><\/p>\n<\/li>\n<li>Double-click on the newly-created module on the left. Copy and paste the following code into the right pane.\n<p><code>Sub UnprotectBook()<br \/>\nThisWorkbook.Unprotect<br \/>\nEnd Sub<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/module-vba-code.png\" alt=\"module-vba-code\" width=\"587\" height=\"272\" class=\"alignnone size-full wp-image-8526\" \/><\/p>\n<\/li>\n<li>Click <strong>Save<\/strong> and you&#8217;re done. If you&#8217;re using a macro-free workbook, you&#8217;ll get the warning message &#8220;<em>The following features cannot be saved in macro-free workbook<\/em>&#8220;. Click <strong>No<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/cannot-macro-free-workbook.png\" alt=\"cannot-macro-free-workbook\" width=\"587\" height=\"284\" class=\"alignnone size-full wp-image-8527\" \/><\/p>\n<\/li>\n<li>In the <strong>Save As<\/strong> dialog box, select &#8220;<strong>Excel-Macro Enabled Workbook (*.xlsm)<\/strong>&#8221; and click <strong>Save<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/macro-enabled-workbook.png\" alt=\"macro-enabled-workbook\" width=\"600\" height=\"377\" class=\"alignnone size-full wp-image-8528\" \/><\/p>\n<\/li>\n<li>When you see the popup message &#8220;<em>Be careful! Parts of your document may include personal information that can&#8217;t be removed by the Document Inspector<\/em>&#8220;, click <strong>OK<\/strong>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/document-inspector-warn.png\" alt=\"document-inspector-warn\" width=\"600\" height=\"120\" class=\"alignnone size-full wp-image-8529\" \/><\/p>\n<\/li>\n<li>Close all of your opened windows. Open the .xlsm file in Excel, right-click your protected sheet tab and select <strong>Delete<\/strong>, next click <strong>Delete<\/strong> to confirm, you&#8217;ll see the failure message: <em>Workbook is protected and cannot be changed<\/em>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2016\/12\/workbook-is-protected.png\" alt=\"workbook-is-protected\" width=\"279\" height=\"123\" class=\"alignnone size-full wp-image-8530\" \/><\/p>\n<\/li>\n<li>That&#8217;s all there is to it.<\/li>\n<\/ol>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How can I protect an Excel worksheet from being deleted? Looking for a way to prevent sheets from being deleted while still allowing them to be hidden or rearranged? In this tutorial we&#8217;ll show you 2 ways to protect a particular or all sheets from being deleted in Excel 2016\/2013\/2010\/2007. Tips: If you want to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10],"tags":[3176,3172,3175,3174,3173],"class_list":["post-8520","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","tag-disable-delete-sheet-in-excel","tag-protect-excel-sheet-with-password","tag-protect-excel-workbook-from-deletion","tag-protect-sheet-from-being-deleted","tag-protect-workbook-structure"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/8520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=8520"}],"version-history":[{"count":6,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/8520\/revisions"}],"predecessor-version":[{"id":8544,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/8520\/revisions\/8544"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=8520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=8520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=8520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}