In Microsoft Excel, you might need to protect your file from deletion. After completing a file you may send it to viewers and you don’t want the viewers to make any unintentional changes to the file. Excel does have some built-in features to protect your excel sheet from deleting data or cells with formulas.
Download Practice Workbook
Download this practice workbook to exercise while you are reading this article.
3 Quick Methods to Protect Excel Sheet from Deleting
In this article, I will share 3 simple methods to protect excel sheets from deleting.
Suppose we have a dataset of some Products and their sales date-wise. Now we are going to protect this worksheet from deleting.
1. Use Password to Protect Excel Sheet from Deleting
To protect the excel sheet from deleting the common and simple method is to protect user passwords. You can save a password for the sheet to protect it from deleting. Follow the steps-
- From the “Home” ribbon click on “Protect Sheet”.
- A new window will appear asking for a password to protect.
- In the “Password to unprotect sheet” provide a password of your choice and press OK to continue.
- Another window will open asking for the confirmation of the password.
- Type the same password you typed in the previous window.
- Click OK.
- This way you can protect your excel sheet from deleting with a password.
2. Activate Read Only Mode to Protect Excel Sheet from Deleting
When you want to restrict your file from deleting you may apply the read-only mode from the built-in tools option. In this method, I will show you a simple method to protect your excel sheet by applying read-only mode.
- Click the “File” option from the top of the workbook.
- Now select “Info” and choose “Always Open Read-Only” from “Protect Workbook”.
Thus you can make your excel sheet to read-only mode and restrict the file from deleting.
- How to Protect Excel Sheet from Viewing Using Password
- Protect Excel Sheet but Allow Data Entry (2 Handy Approaches)
- How to Protect an Excel Sheet Except for Certain Cells (2 Ways)
3. Run a VBA Code to Protect Excel Sheet from Deleting
You can also run a VBA code to protect the excel sheet.
- Put the cursor on the sheet section and click the right button of the mouse to open Options.
- From the options go to “View Code”.
- The VBA window will open.
- In the new window, choose your sheet and then run the following code-
Private Sub Worksheet_Activate() ActiveWorkbook.Protect "123" End Sub Private Sub Worksheet_Deactivate() ActiveWorkbook.Unprotect "123" End Sub
- As you can see I have put the password “123” in the code. You can choose your own password and put it in the code section.
- Press Alt+Q to close the “Microsoft Visual Basic for Applications” window.
- Now shift to another worksheet and go back to the previous sheet to active the VBA code.
- Right-click on the sheet tab and you will see the “Delete” option is gray which means you can not delete the sheet.
So, applying this VBA code we have successfully protected our sheet from deleting.
Things to Remember
- You might also need to unprotect the sheet after protecting the file with a password. To do that go to “Review” and select “Unprotect Sheet”. Now type the password and your sheet will be unprotected.
- You can also protect your whole workbook. Go to File > Info > Protect Workbook Structure > Password > OK.
In this article, I have shown some easy methods to protect excel sheets from deleting. Take a tour of the practice workbook and download the file to practice by yourself. Hope you find it useful. Please inform us in the comment section about your experience. We, the ExcelDemy team, are always responsive to your queries. Stay tuned and keep learning.