How to Lock Multiple Cells in Excel – 6 Methods

This is the sample dataset.

Dataset for How to Lock Multiple Cells in Excel

 


Method 1 – Using the Format Cells Option

Step 1 – Removing the Default “Locked” Option

  •  Place the cursor in the dataset.
  • Select the dataset by pressing Ctrl A.

Using the Format Cells Option

  • Right-click and choose Format Cells or press Ctrl 1.
  • Uncheck Locked.
  • Click OK.

Using the Format Cells Option

Step 2 – Locking Specific Multiple Cells

  • Select a cell range to lock (here, B5:F9).

Using the Format Cells Option

  • Right-click and choose Format Cells or press Ctrl 1.
  • Check Locked.
  • Click OK.

Using the Format Cells Option

 

Step 3 – Activate the Sheet Protection

  • Go to the Review tab.
  • Click Protect Sheet in Protect.

Using the Format Cells Option

  • Enter a password and click OK.

Using the Format Cells Option

  • Reenter the password.

Using the Format Cells Option

The selected cells are locked and protected.

If you click B5, an error message is displayed.

Using the Format Cells Option

Read More: How to Protect Excel Cells with Formulas


Method 2 – Adding a Button from the Quick Access Toolbar

  • Click Customize Quick Access Toolbar and choose More Commands.

How to Lock Multiple Cells in Excel Adding a Button from Quick Access Toolbar

  • Choose All Commands in Choose commands from.
  • Select Lock Cell and click Add.
  • Click OK.

How to Lock Multiple Cells in Excel Adding a Button from Quick Access Toolbar

The Lock Cell icon is displayed.

  • Remove the default “locked” option and select C5:D15.
  • Click Lock Cell in the Quick Access Toolbar.

How to Lock Multiple Cells in Excel Adding a Button from Quick Access Toolbar

The selected cells are locked. Follow step 3 in Method 1 to protect the sheet.

Read More: How to Protect Excel Cells with Password


Method 3 – Locking Cells containing Formulas

  • Go to the Home tab.
  • Select Go To Special in Find & Select.

How to Lock Multiple Cells in Excel Locking Cells Having Formulas

  • Select Formulas and click OK.

How to Lock Multiple Cells in Excel Locking Cells Having Formulas

You will see cells containing formulas: F5:F15.

How to Lock Multiple Cells in Excel Locking Cells Having Formulas

Follow the steps described in the previous Methods to lock the cells and protect the sheet.


Method 4 – Using a VBA Code

  • Go to the Developer tab > Visual Basic.

How to Insert VBA Code

  • Select Insert > Module.

How to Insert VBA Code

Copy the following code into the module.

Sub Locking_Protecting_MultipleCells()
Dim LPassword As String
Range("B5:F8").Select
Selection.Locked = True
LPassword = InputBox("Enter the Password to Protect")
ActiveSheet.Protect Password:=LPassword
End Sub

How to Lock Multiple Cells in Excel Using VBA Code

LPassword is declared as String. Cells are selected using the Range.Select method. The Locked property is set as True to lock the cell range. An InputBox is assigned to enter a password. The Protect Password method protects the active sheet.

  • Press F5 or Fn + F5 to run the code.

How to Lock Multiple Cells in Excel Using VBA Code

  • Enter the password.

The selected cells are locked. If you select a cell (e.g. D5) and try to edit it, an error message is displayed

How to Lock Multiple Cells in Excel Using VBA Code


Method 5 – Manually Lock Multiple Cells

  • To find the sales of a specific order ID, use the VLOOKUP function.

=VLOOKUP(G5,B5:E15,4,FALSE)

G5 is the lookup value, B5:E15 is the table array, 4 is the column index, and FALSE is used for an exact match.

  • Add the Dollar sign ($) to the table array manually: $B$5:$E$15.
  • The formula becomes:

=VLOOKUP(G5,$B$5:$E$15,4,FALSE)

Manually Locking Multiple Cells for Making Absolute References

  • Press Enter.

You’ll see the output: $3000 for the Order ID 101.

Manually Locking Multiple Cells for Making Absolute References

  • Drag down the Fill Handle to see the result in the rest of the cells.

Manually Locking Multiple Cells for Making Absolute References

Read More: How to Lock Cell Value Once Calculated in Excel


Method 6 – Using the Keyboard Shortcut: F4

  • In the formula, select the cell range to use the absolute references. Here, B5:F15.
  • Press F4 keeping the cursor on the selected cell range.

How to Lock Multiple Cells in Excel Using the Keyboard Shortcut F4 Key

The $ sign is added to the cell range. So the formula becomes:

=VLOOKUP(H5,$B$5:$F$15,5,FALSE)
 

How to Lock Multiple Cells in Excel Using the Keyboard Shortcut F4 Key

  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

How to Lock Multiple Cells in Excel Using the Keyboard Shortcut F4 Key

To use the shortcut key in different situations:

Shortcut Cell Reference Description
Press F4 Multiple Cells Changes neither the column nor the row.
Press F4 twice Row Reference Changes the column reference but not the row reference.
Press F4 thrice Column Reference Changes the row reference but not the column reference.

Read More: How to Lock a Cell in Excel Formula


Download Practice Workbook


Related Articles


<< Go Back to Protect Excel Cells | Excel Protect | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdul Kader
Md. Abdul Kader

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo