3 ways to prevent an Excel sheet being deleted

You always come across that one problem when you use digital media: is my data secure, is my data protected, and can it be saved in a way that it won’t get deleted?

In this blog, we will illustrate a couple of different ways you can prevent Excel sheets from being deleted. Follow through for more information on how you can do this.

  1. Password protect a workbook
  2. Use the VBA editor to prevent an Excel sheet being deleted
  3. Set Excel files to “Read-only” mode.

After some extensive research, I came across a few different options to help prevent the deletion of Excel sheets, some more complex than others, however, they will all help prevent the deletion of sheets in Excel. Follow through for the full list of instructions on how to deploy all of the prevention techniques. 

surface pro 8Surface Go 3surface pro 8

Password protect a workbook to prevent the Excel sheet from being deleted

To keep all worksheets in an Excel file from being erased, just activate the Protect Workbook function in Excel’s Review tab. This feature can prevent changes to an Excel workbook’s structure and windows. Users of this Excel worksheet will be unable to add, remove, rename, or move sheets once this feature is activated (depending on how you configure the feature). The steps are as follows.

Step by step process – Preventing the deletion of files by Password protecting a workbook

  • Firstly, open your Excel worksheet.
  • After that click on “Review”.
  • Now click on “Protect Workbook”.
  • Now type in a password of your choice.
  • After that click on “OK”.

A safe and easy way to protect your workspace and sheets, now when you try to delete a sheet it will refrain you from doing so by greying out the button. You can unprotect the sheet to delete if you want, however for that you will need to type in the password you just set. Note the password before you protect the workspace. If you use a password to safeguard the workbook, keep the password in a secure location. If the password is forgotten or lost, it cannot be restored and must be removed with a third-party program such as Workbook Protection Refixer.

Microsoft cannot recover lost passwords, so make your password very memorable. There are no length, character, or number limits on the passwords you use, but they are case-sensitive. It’s not always safe to send password-protected files containing sensitive information like credit card details. When exchanging files or passwords with other users, use caution. Passwords are still in danger of slipping into the hands of unwanted users. Keep in mind that locking a file with a password may not always safeguard it from harmful intent.


excel basics advanced excel excel workbook

How can I see if a Workbook is indeed protected

  • See the Protect Workbook symbol on the Review tab. If it’s highlighted, the worksheet is safe.
  • When you click on the bottom of a sheet in your workbook, you’ll see that the choices for changing the structure of the workbook, such as Insert, Delete, Rename, Move, Copy, Hide, and Unhide sheets, are all disabled.
  • The Protect Workbook option in the Info menu also shows that the structure of the workbook is protected. To access this option, navigate to File > Info > Protect Workbook.

Use the VBA editor to prevent an Excel sheet being deleted

Excel VBA is a sophisticated technology that allows you to automate processes in Excel. It may be used to automate a variety of monotonous chores as well as more complicated applications. This fast tip tutorial will teach you how to open the Excel Visual Basic Editor (also known as the Excel VBA Editor) and begin using VBA programming in Excel. With access to the VBA editor, you may develop your own VBA code or check previously recorded macros. Continue reading to find out. How to keep an Excel sheet from being destroyed Using the VBA Editor in Microsoft Excel.

Step by step process – Use the VBA editor to prevent an Excel sheet being deleted

  • Open the Excel spreadsheet.
  • By clicking on the tab at the bottom of this Excel file, you may protect a certain sheet from deletion. Select View Code from the context menu when you right-click on the tab.
  • In the Code box, enter the following codes. Substitute “yourpassword” with your real password.

Private Sub Worksheet_Activate()

ThisWorkbook.Protect “yourpassword”

End Sub

Private Sub Worksheet_Deactivate()

ThisWorkbook.Unprotect “yourpassword”

End Sub

  • To save the VB project, click the Save button or press Ctrl + S. When the following dialogue appears, select No

Macro recording in Excel is a terrific technique to automate chores as well as a great tool for learning more VBA code. One frequent technique is to record a macro and then examine the VBA code to understand how it works. You should be able to record a macro, open the VBA editor, and read the code now that you know how to do it in Excel. You’ll notice that the system-produced VBA is a little jumbled, but it will provide you with the crucial pieces of code required for the desired operation. Formatting, copying, pasting, removing, or picking a sale are examples of these. Alternatively, you may get pretty proficient and complete full tasks before using the Excel visual basic editor to evaluate the code.

Set Excel files to “Read-only” mode

If you don’t want content reviewers to mistakenly change your document, make it read-only before submitting it for review. Another approach is to limit formatting and editing.

Making your document a read-only file implies that it may be read but not updated. If one of the reviewers attempts to make modifications to a read-only file, the changes can only be preserved by renaming the document or saving it to a different place.

Step by step process – Set Excel files to “Read-only” mode.

  • Open the Excel spreadsheet.
  • After that go to “Review” > “Restrict Editing”.
  • Check the Editing Restrictions box. Allow just this form of modification in the document, and make sure No changes is checked off the list (Read only).
  • Yes, begin enforcing protection.
  • In the box that appears, input a password you’ll remember, and then type it again to confirm it.

You can make the document read-only before sending it for review if you don’t want content reviewers to mistakenly edit it. Another approach would be to limit formatting and editing. Making your document a read-only file implies that it can be read but not changed. If a reviewer attempts to make modifications to a read-only file, the changes can only be preserved by renaming the document or saving it to a different place.

In depth – Step by step process – Preventing the deletion of files by Password protecting a workbook

Step by step breakdown

  • Firstly, open your Excel worksheet.
  • After that click on “Review”.
  • Now click on “Protect Workbook”.
  • Now type in a password of your choice.
  • After that click on “OK”.

That’s it for this Blog thank you for taking time out to read our content, please feel free to email our team about how it went if you followed the steps or if you need more help with the questions we answered in this Blog.

Saajid Gangat

Saajid Gangat has been a researcher and content writer at Business Tech Planet since 2021. Saajid is a tech-savvy writer with expertise in web and graphic design and has extensive knowledge of Microsoft 365, Adobe, Shopify, WordPress, Wix, Squarespace, and more! You can connect with Saajid on Linkedin.

Recent Posts