Excel Practice Test

โ–ถ

Locking cells in Excel โ€” and the related question of how to lock rows in Excel for scrolling โ€” covers two distinct concepts that users often confuse. Cell locking with worksheet protection prevents users from editing specific cells, supporting templates, shared workbooks, and protected models where some cells should remain unchanged. Row locking through Freeze Panes keeps specific rows visible at the top of the worksheet as you scroll through data, supporting navigation of large datasets where the header rows need to remain visible at all times. This guide covers both concepts plus several related techniques.

This guide walks through how to lock cells with worksheet protection, how to lock rows by freezing panes for scroll-locking visibility, how to lock formulas while keeping data entry cells editable, and how to lock entire worksheets or specific ranges. The methods apply to Excel 365, Excel 2019, Excel 2021, and Excel for the web with notes where features differ. Most operations work consistently across Windows and macOS with minor menu placement variations between the platforms. Choosing the right locking technique depends on whether you want to prevent editing or maintain visibility while scrolling.

Before diving into specific methods, an important conceptual distinction. Excel cells have a 'Locked' property that defaults to TRUE for all cells. However, this property has no effect until worksheet protection is activated through Review โ†’ Protect Sheet. Without worksheet protection, the Locked property does nothing โ€” every cell is editable regardless of its Locked setting. The two-step process (set Locked property, then activate protection) is necessary because Excel needs both pieces โ€” the per-cell flag and the worksheet-level protection โ€” to enforce locking that prevents user edits effectively.

Lock Cells in Excel Quick Answer

To lock specific cells: Select all cells (Ctrl + A), Format Cells (Ctrl + 1) โ†’ Protection tab โ†’ uncheck Locked. Then select cells to lock, Ctrl + 1 โ†’ Protection โ†’ check Locked. Then Review โ†’ Protect Sheet with optional password. To lock rows for scrolling: Click row below rows you want frozen, View โ†’ Freeze Panes โ†’ Freeze Panes. Lock top row only: View โ†’ Freeze Panes โ†’ Freeze Top Row. Lock formulas: Same as cell locking but check Hidden in Protection tab too. Without protection: Locked property does nothing โ€” both steps required.

The standard workflow for locking specific cells in Excel involves three steps: setting up the Locked property correctly across all cells, activating worksheet protection, and optionally using a password to control who can remove the protection. By default, all cells in a new worksheet have their Locked property set to TRUE โ€” meaning they will all be locked when worksheet protection activates. This is rarely the desired behaviour because most worksheets need at least some cells to remain editable for data entry or other user interaction. The first step is therefore typically unlocking the cells that should remain editable.

To unlock cells that should remain editable, select those cells (you can use Ctrl + click or Shift + click for non-adjacent or range selections), press Ctrl + 1 to open Format Cells, click the Protection tab, uncheck the Locked checkbox, and click OK. The selected cells are now marked as unlocked โ€” they will remain editable when worksheet protection activates. Then select the cells that should be locked (or leave them with the default Locked = TRUE), confirm the Locked property is checked, and proceed to activate worksheet protection through the Review menu.

Cell Locking Methods in Excel

๐Ÿ”ด Lock All Cells

Default state โ€” all cells locked. Just enable worksheet protection (Review โ†’ Protect Sheet).

๐ŸŸ  Lock Selected Cells

Unlock all โ†’ re-lock specific cells โ†’ enable protection. Common pattern for templates.

๐ŸŸก Lock Formulas Only

Format Cells โ†’ Protection โ†’ check Locked AND Hidden. Hides formula in formula bar.

๐ŸŸข Lock Specific Range

Allow Edit Ranges feature. Different users can edit different ranges with separate passwords.

๐Ÿ”ต Freeze Rows for Scrolling

View โ†’ Freeze Panes. Keeps rows visible while scrolling โ€” different concept from locking.

๐ŸŸฃ Protect Workbook

Review โ†’ Protect Workbook. Prevents adding/removing/renaming sheets, not cell-level.

For locking rows in Excel in the sense of keeping them visible during scrolling, the Freeze Panes feature provides the right solution. Click the row below the rows you want to freeze (e.g., to freeze just row 1, click row 2). Click the View tab, click Freeze Panes in the Window group, and choose Freeze Panes from the dropdown.

The selected row and all rows above it become frozen โ€” they remain visible at the top of the worksheet view as you scroll down through data. To freeze only the top row without considering current selection, choose Freeze Top Row from the same dropdown.

Freeze Panes is essential for navigating large datasets where header rows need to remain visible. Without freezing, scrolling down past row 30 or so loses the header row context, making it hard to remember which column contains what data. With Freeze Panes active, the header row stays visible regardless of how far you scroll down, providing constant context for the data being viewed. To unfreeze, return to View โ†’ Freeze Panes and choose Unfreeze Panes from the dropdown menu โ€” the previously frozen rows return to normal scrolling behaviour.

For freezing both rows and columns simultaneously (common when scrolling through wide data with both row headers and column headers needing visibility), select the cell that should be the top-left of the scrollable area. For example, to freeze the first row and first column, click cell B2 โ€” everything above and to the left of B2 becomes frozen. Click View โ†’ Freeze Panes โ†’ Freeze Panes. Now both row 1 and column A remain visible regardless of scrolling direction, providing complete header context for navigating large multi-dimensional datasets effectively.

๐Ÿ“‹ Lock cells (template style)

Steps: 1) Select all cells (Ctrl + A). 2) Format Cells (Ctrl + 1) โ†’ Protection โ†’ uncheck Locked. 3) Select cells to lock (formulas, headers). 4) Format Cells โ†’ Protection โ†’ check Locked. 5) Review โ†’ Protect Sheet, set password optional. Result: Users can edit specified cells but cannot modify locked cells. Common use: Templates with data entry cells unlocked and formulas/headers locked.

๐Ÿ“‹ Freeze rows for scrolling

Top row only: View โ†’ Freeze Panes โ†’ Freeze Top Row. Quick option for header row. Multiple rows: Click row below last row to freeze, View โ†’ Freeze Panes โ†’ Freeze Panes. Both rows and columns: Click cell at top-left of scrollable area, View โ†’ Freeze Panes โ†’ Freeze Panes. Unfreeze: View โ†’ Freeze Panes โ†’ Unfreeze Panes.

๐Ÿ“‹ Lock formulas (hide them too)

Steps: Select cells with formulas, Format Cells โ†’ Protection โ†’ check both Locked AND Hidden. Then Review โ†’ Protect Sheet. Result: Cells locked from editing AND formula bar shows nothing when locked cells are selected. Use when: Templates where users see calculation results but not formulas (proprietary calculations, simplified UI).

Worksheet protection through Review โ†’ Protect Sheet provides several configuration options worth understanding. The dialog asks for an optional password (without password, anyone can unprotect the sheet through the Review menu). Below the password, a list of options controls what protected users can still do โ€” by default, locked cells cannot be selected or modified, but unlocked cells can. Various checkboxes allow protected users to format columns/rows, insert/delete content, sort, filter, use AutoFilter, edit objects, and so on. Configure these to balance protection with the user functionality needed in the worksheet.

For more granular control over which users can edit which ranges (rather than universal lock/unlock), the Allow Edit Ranges feature provides flexibility. Through Review โ†’ Allow Edit Ranges, you can define multiple ranges, each with its own password and permitted users. Different users can edit different ranges with their respective passwords, while the rest of the worksheet remains protected. This is particularly useful for shared workbooks where different team members own different sections โ€” sales team edits sales region, finance team edits finance region, with each having password access only to their respective area.

Locking formulas while keeping their results visible is a common requirement for templates. To lock and hide formulas, select the cells containing formulas, press Ctrl + 1 to open Format Cells, click Protection tab, check both the Locked and Hidden checkboxes, and click OK. Then activate worksheet protection through Review โ†’ Protect Sheet. With both Locked and Hidden checked plus protection active, users selecting these cells will see the calculated results but the formula bar will appear empty โ€” hiding the formula logic from view while preserving the visible calculation results in the spreadsheet display.

For users wanting to lock the entire workbook structure (preventing addition, deletion, or renaming of worksheets) rather than just cell-level locking, the Protect Workbook feature provides this. Through Review โ†’ Protect Workbook, you can prevent users from adding new sheets, deleting existing sheets, renaming sheets, hiding/unhiding sheets, or moving sheets within the workbook. The optional password protects the protection itself. Note that Protect Workbook is separate from Protect Sheet โ€” you can use one, the other, or both depending on the level of protection your workbook requires for the intended user audience.

For scenarios where you want to lock cells but allow specific users to edit specific ranges, the Allow Edit Ranges workflow provides this. Through Review โ†’ Allow Edit Ranges, click New to define a range. Specify a title, the range itself, and a password for that range. Optionally specify Windows users or groups (via Permissions button) who can edit without password if connected to a domain.

Click OK and add additional ranges as needed. After defining ranges, activate worksheet protection. Now users with the appropriate password can edit their assigned range without entering the protection password โ€” only the specific range password is required for them.

Common mistakes when locking cells in Excel include several recurring issues. Forgetting that the Locked property has no effect without worksheet protection โ€” users wonder why cells they marked as locked are still editable. The two-step process (set Locked property AND activate protection) is necessary. Another common mistake is locking too much โ€” protecting all cells when only specific cells should be protected, frustrating users who can't perform basic interactions like sorting, filtering, or cell selection. Configure the protection options to allow appropriate user actions on locked cells like selection, sorting, and filtering.

Locking Cells Best Practices

Decide which cells need to be editable (data entry) and which should be locked (formulas, headers)
Select all cells (Ctrl + A), unlock by clearing Locked checkbox in Format Cells Protection tab
Select cells to lock, check Locked checkbox to enable lock for those specific cells
Activate worksheet protection through Review โ†’ Protect Sheet with optional password
Configure protection options to allow appropriate user actions (sort, filter, select)
Test the workbook by trying to edit locked vs unlocked cells
For freeze panes, click row below rows to freeze, then View โ†’ Freeze Panes
For hidden formulas, check Hidden checkbox alongside Locked in Protection tab
Document the protection scheme in workbook for future reference
Remember: Excel protection is usability, not real security โ€” don't rely on it for sensitive data

Common scenarios for cell locking in Excel illustrate the practical applications of these techniques. Templates designed for repeated data entry typically lock formulas, headers, and structural elements while leaving data entry cells unlocked. Annual budget templates lock the calculation logic and category rows while leaving monthly value cells editable. Time tracking templates lock task descriptions and rate columns while leaving hours-worked columns editable. Each template benefits from cell locking that enforces the intended structure while supporting the data entry users need to perform.

For shared workbooks where multiple users contribute to the same file, cell locking with Allow Edit Ranges supports controlled collaboration. Sales team edits revenue cells, expenses team edits cost cells, finance reviews and edits totals, with each team having their own range password. The protection scheme prevents accidental cross-team edits while allowing intended editing within each team's domain. Document who has access to which range so handoffs and updates work smoothly across the team without confusion about responsibilities.

For dashboards and reports distributed to stakeholders, cell locking prevents accidental edits that would disrupt the displayed data. Lock all cells, particularly chart-source ranges, summary calculations, and any cell that should remain stable across viewing. Stakeholders can interact with the workbook (sort, filter, view) without risk of accidentally breaking calculations or moving data. The locked state communicates that this is a finished deliverable rather than an editable working file, supporting appropriate use of the workbook by recipients in their reading mode rather than authoring mode.

Take an Excel Practice Quiz

For Excel power users automating cell locking through VBA, the property-setting and protection activation are straightforward. Range.Locked = False unlocks specific cells. Range.Locked = True locks them. Worksheet.Protect Password:='secret' activates protection. Worksheet.Unprotect Password:='secret' removes it. For dynamic protection schemes that change based on workbook state, conditional logic in macros can adjust which cells are locked before activating protection. For repeatable workflows that distribute the same protected template to multiple users, VBA automation eliminates the manual click-through that would otherwise be required for each new template instance distributed.

For freeze panes via VBA, ActiveWindow.SplitRow = 1 freezes the first row, ActiveWindow.SplitColumn = 1 freezes the first column, and ActiveWindow.FreezePanes = True activates the freeze. Alternatively, range-based: ActiveWindow.FreezePanes = False (clear any existing freeze), select the cell that should be top-left of scrollable area, then ActiveWindow.FreezePanes = True freezes everything above and to the left of that cell. These VBA patterns support automated workbook setup where multiple sheets need consistent freeze panes configuration applied programmatically.

For users transitioning between Excel and Google Sheets, the locking concepts transfer with adjustments. Google Sheets uses 'Protected sheets and ranges' from Data menu โ€” different terminology but similar concept of restricting edits to specific users or ranges. Google Sheets has 'Freeze' option under View menu โ€” similar to Excel's Freeze Panes. Both products support the conceptual operations though specific menus and options differ. Files with Excel protection typically transfer to Google Sheets with protection intact, though some advanced protection options may need reconfiguration in the new environment.

The bottom line on locking cells and rows in Excel: use Format Cells Protection tab to set Locked property, then activate Review โ†’ Protect Sheet to enforce the lock. For freeze panes (locked rows during scrolling), use View โ†’ Freeze Panes with the cell selected just below/right of frozen area. Combine these techniques as needed โ€” many templates use both cell locking and freeze panes for complete user-experience design. Remember that Excel protection is usability and presentation protection rather than genuine security against determined users seeking to bypass it.

Excel Lock Cells Quick Reference

TRUE
Default Locked
Yes
Protection Required
5+
Methods
View Menu
Freeze Panes

When to Use Each Locking Method

๐Ÿ”ด Cell Locking + Protection

Templates where some cells are editable and others are not. Most common scenario.

๐ŸŸ  Lock + Hide Formulas

Templates where users see results but not formula logic. Proprietary calculations.

๐ŸŸก Allow Edit Ranges

Multi-user workbooks where different users edit different ranges with separate passwords.

๐ŸŸข Protect Workbook

Preventing structural changes (adding/removing/renaming sheets) โ€” different from cell-level.

๐Ÿ”ต Freeze Panes

Keep header rows visible while scrolling. Not actually 'locking' but commonly confused term.

๐ŸŸฃ Read-Only File

File-level protection through Save As โ†’ Tools โ†’ General Options โ†’ Read-only recommended.

For users dealing with shared workbooks where multiple people simultaneously edit the same file, modern Excel supports co-authoring through OneDrive or SharePoint. Co-authored workbooks have their own considerations around cell locking โ€” protection settings apply to all co-authors, so locking cells affects everyone editing the file. For co-authored scenarios, plan the locking scheme carefully to balance protection with the collaborative editing all users need. Consider whether traditional cell locking is appropriate or whether a different approach (like separate per-user worksheets) better fits the collaborative nature of the workbook editing scenario.

For users wanting to undo cell locking changes, several approaches help. Pressing Ctrl + Z immediately after Format Cells changes typically undoes the lock property change before saving. After saving, the changes are persistent โ€” but you can simply reverse the operation: select the cells, Format Cells โ†’ Protection โ†’ uncheck Locked. To remove worksheet protection entirely, Review โ†’ Unprotect Sheet (entering password if one was set). Worksheet protection is fully reversible at any point, supporting iterative refinement of templates as user needs evolve over time across multiple workbook revisions.

For Excel users who want to verify which cells are locked versus unlocked, several inspection methods help. Format Cells dialog Protection tab shows the current Locked status for selected cells. Conditional formatting can apply formatting based on whether cells are locked using a custom formula like =CELL("protect", A1)=1 returning TRUE for locked cells. VBA can iterate through ranges and report Locked status programmatically. For complex workbooks with many locked and unlocked cells, building a quick visual audit through conditional formatting helps verify the locking scheme is configured correctly before distributing the template.

For mixing protection with data validation, the two features work together. Data validation rules apply regardless of cell lock status โ€” even unlocked cells respect their data validation rules. Protected workbooks with locked cells may want some unlocked cells to have data validation enforcing valid values for data entry. The combination produces templates where users can enter data but only valid values, protecting both the structure (locked cells) and data quality (validation on unlocked cells). Many production templates use this combination effectively to balance flexibility with controls supporting data quality.

Excel Cell Locking: Pros and Cons

Pros

  • Prevents accidental edits to formulas and important cells
  • Supports template structure enforcement
  • Multi-user editing through Allow Edit Ranges
  • Combined with Hidden, can hide formula logic
  • Freeze Panes provides scrolling lock for large data

Cons

  • Not real security โ€” can be bypassed by determined users
  • Two-step process (Locked + Protect) confuses some users
  • Default state has all cells locked, often requiring inversion
  • Co-authored workbooks have different protection considerations
  • Excessive locking creates poor user experience
Practice Excel Skills Quiz

Excel Questions and Answers

How do I lock cells in Excel?

Two steps required. First, set the Locked property: select cells, press Ctrl + 1 โ†’ Protection tab โ†’ check Locked checkbox. Second, activate worksheet protection: Review โ†’ Protect Sheet (with optional password). Without protection activated, the Locked property has no effect โ€” both steps are necessary. By default all cells are Locked, so you typically unlock the cells that should remain editable rather than locking specific cells.

How do I lock rows in Excel?

Two different meanings. To lock rows from editing: same as locking cells with worksheet protection. To lock rows for scrolling (keep visible while scrolling): use Freeze Panes. Click the row below rows you want frozen (e.g., row 2 to freeze just row 1), then View โ†’ Freeze Panes โ†’ Freeze Panes. The frozen rows remain visible at the top of the worksheet while you scroll through data.

What is the difference between Lock Cells and Freeze Panes?

Lock Cells (with Protection) prevents users from editing specific cells. Freeze Panes keeps specific rows or columns visible at the edge of the worksheet view while scrolling through data. They serve different purposes โ€” locking is about edit prevention, freezing is about visibility maintenance. Both are useful but for different scenarios. Many templates use both โ€” locking formulas and headers from edit, while freezing header rows for scrolling visibility.

How do I lock formulas in Excel without locking data entry cells?

Select all cells (Ctrl + A), Format Cells โ†’ Protection โ†’ uncheck Locked (this unlocks everything). Then select cells with formulas, Format Cells โ†’ Protection โ†’ check Locked (this re-locks just the formula cells). Then Review โ†’ Protect Sheet to activate protection. Now users can edit data entry cells but cannot modify formula cells. This pattern is the most common cell locking scenario for templates with mixed editable/protected cells.

Can I lock cells with a password in Excel?

Yes โ€” when activating worksheet protection through Review โ†’ Protect Sheet, you can optionally enter a password. Users can still see the locked cells but cannot edit them, and only users with the password can remove the protection. Note that Excel passwords use relatively weak encryption that can be bypassed with determined effort, so don't rely on this for genuinely sensitive data โ€” it's primarily protection against accidental edits and casual unauthorized changes.

How do I unlock all cells in Excel?

Two approaches. To unlock cells (clear the Locked property): select all cells (Ctrl + A), Format Cells (Ctrl + 1) โ†’ Protection โ†’ uncheck Locked. To remove worksheet protection (which is what allows the locked property to take effect): Review โ†’ Unprotect Sheet (enter password if one was set). Both result in editable cells, but they accomplish this differently โ€” clearing the property versus removing the protection that enforces the property.
โ–ถ Start Quiz