Locking cells or password-protecting scripts in Microsoft Excel is important to keep your data safe and secure. Doing so can prevent unauthorized access and modification of sensitive information. In this article, we’ll guide you through the steps of locking cells and password-protecting scripts in Excel, along with some keyboard shortcuts and tips.

How to lock cells in Excel

Locking cells in Excel is a handy feature that is used to protect the data from accidental or intentional modifications. If you have created a complex worksheet with formulas and calculations, it is recommended that you lock the cells containing these formulas to prevent users from changing them.

To lock cells in Excel, follow these steps:

  1. Select the cells that you want to lock.
  2. Right-click on the cells and select “Format Cells”.
  3. In the “Protection” tab, check the “Locked” option.
  4. Click on “OK” to save the changes.

Now, you need to protect the worksheet to enable the locking feature. To do that:

  1. Go to the “Review” tab on the ribbon.
  2. Click on “Protect Sheet”.
  3. Check the boxes for the actions that you want to restrict, such as selecting, formatting, and editing cells.
  4. Enter a password to lock the sheet.
  5. Click on “OK” to save the changes.

Once the sheet is protected, the locked cells will be protected from being modified by the user. If you want to make changes to the locked cells, you need to unprotect the sheet first.

Keyboard shortcuts for locking cells in Excel

Excel offers some convenient keyboard shortcuts that can help you work faster and more efficiently. Here are some useful shortcuts for locking cells:

  • CTRL+1: Opens the “Format Cells” dialog box.
  • ALT+H+O>I: Locks the selected cells.
  • CTRL+SHIFT+2: Applies the “Time” format to cells.
  • CTRL+SHIFT+3: Applies the “Date” format to cells.
  • CTRL+SHIFT+4: Applies the “Currency” format to cells.

How to password-protect VBA code in Excel

If you have created macros or VBA code in your Excel workbook, you may want to password-protect them to prevent unauthorized access and modification. Here’s how you can do it:

  1. Open the Visual Basic Editor by pressing ALT+F11.
  2. Select the module that contains the code that you want to protect.
  3. Click on “Tools” from the menu bar and select “VBAProject Properties”.
  4. Select the “Protection” tab and check the “Lock project for viewing” option.
  5. Enter a password to protect the code.
  6. Click on “OK” to save the changes.

Now, the VBA code in your Excel workbook is password-protected. When someone tries to access or modify the code, they will be prompted for a password.

Keyboard shortcuts for VBA code in Excel

If you frequently work with VBA code in Excel, you can use the following keyboard shortcuts to save time:

  • ALT+F11: Opens the Visual Basic Editor.
  • F5: Runs the code that is currently selected.
  • CTRL+G: Opens the “Immediate” window.
  • CTRL+R: Opens the “Project Explorer” window.
  • CTRL+E: Opens the “Properties” window.
Baca Juga :  Cara Membuat Grafik Garis Di Excel 2017


Q: What is the difference between locked and unlocked cells in Excel?

A: Locked cells in Excel are cells that have been protected so that they cannot be edited. Unlocked cells, on the other hand, are cells that can be edited. You can use the “Format Cells” dialog box to lock or unlock cells in Excel.

Q: How do I unprotect a worksheet in Excel?

A: To unprotect a worksheet in Excel, go to the “Review” tab on the ribbon and click on “Unprotect Sheet”. If the sheet is password-protected, you will need to enter the password to unlock it.

Include a video

For a visual guide on how to lock cells and password-protect VBA code in Excel, check out this helpful video:

In conclusion

Locking cells and password-protecting scripts in Excel is an essential step to keep your data secure. By following the steps outlined in this article, you can easily protect your sensitive information from unauthorized access and modification. Use the keyboard shortcuts and tips provided in this article to work more efficiently and streamline your Excel workflow.