VBA & Macro Problems

How to Require an Excel Checkbox Selection Before Moving to the Next Row

Phi Hung VoPhi Hung Vo Oct 15, 2026 870 views

Question details

The user needs to prevent data entry in the next row of a worksheet until a specific checkbox in the previous row is selected.

How to Require a Checkbox Selection Before Moving to the Next Row in Excel
Product
Excel
Device & OS
not provided
Scenario
Creating a sequential data entry form or checklist where users must complete the previous row's requirement before navigating downward.
Observed behavior
Without validation, users can skip rows freely. The goal is to enforce a strict sequential flow, warning the user and blocking row selection if the prior checkbox is unchecked.
Before you start

Ensure the Developer tab is enabled in your Excel ribbon and that your checkboxes are linked to specific hidden or visible cells so VBA can easily read their TRUE/FALSE status.

Solution 1Recommended

Use a VBA Worksheet_SelectionChange Event

Implement a background macro that automatically checks the status of the previous row's checkbox whenever a user clicks a new cell.

Built-in Data Validation cannot restrict cursor movement or row selection natively. To achieve this, you must use a VBA Worksheet_SelectionChange event. This macro evaluates the target row and forces the user back to the previous row if the prerequisite checkbox is not selected.

1
Link Your Checkboxes to Cells

Right-click your checkbox, select 'Format Control', and set the 'Cell link' to a cell in the same row (e.g., Column A). This linked cell will display TRUE when checked and FALSE when unchecked.

2
Open the VBA Editor

Press Alt + F11 to open the Visual Basic for Applications editor. In the Project Explorer pane on the left, locate your workbook and double-click the specific worksheet (e.g., Sheet1) where you want this rule applied.

3
Insert the SelectionChange Code

Choose 'Worksheet' from the top-left dropdown and 'SelectionChange' from the top-right dropdown. Insert an If-statement to check if the newly selected Target.Row is greater than 1, and if the linked cell in Target.Row - 1 equals FALSE.

4
Add Warning and Redirection

Inside the If-statement, use MsgBox to display a warning like 'Please complete the previous row first.' Then, use Cells(Target.Row - 1, 1).Select to force the cursor back to the previous row.

5
Save as a Macro-Enabled Workbook

Go to File > Save As, and choose 'Excel Macro-Enabled Workbook (*.xlsm)' to ensure your VBA script is preserved and active upon reopening.

Use a VBA Worksheet_SelectionChange Event
Code Placement is Critical: The macro code must be placed in the specific Worksheet module (e.g., Sheet1) and not in a standard Module. Otherwise, the SelectionChange event will not trigger when you click around the sheet.

Easily Manage Macros and VBA with WPS Office

WPS Spreadsheet provides excellent compatibility with Microsoft Excel macros and VBA code. You can quickly implement row validation scripts and form controls directly within its intuitive Developer interface.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook.
  2. 2. Access Developer Tools: Navigate to the Developer tab on the top ribbon to access form controls.
  3. 3. Launch the VBA Editor: Click 'Visual Basic' to open the editor and paste your Worksheet_SelectionChange code.
  4. 4. Save with Macros: Save your file as an XLSM format seamlessly without losing functionality.
Full compatibility with Excel XLSM formats and VBA macrosBuilt-in Developer tools for advanced scripting and form controlsLightweight application with high performanceFamiliar interface that requires no learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my Worksheet_SelectionChange macro triggering?

This usually happens if the VBA code was accidentally placed in a standard Module instead of the Worksheet object. Open the VBA editor and ensure the code is located under the corresponding 'Sheet' object in the Project Explorer.

Can I use standard Excel Data Validation instead of VBA for this?

No. Standard Data Validation can only prevent typing invalid data into a cell. It cannot restrict a user from simply clicking, selecting, or scrolling to a different row. VBA is required to restrict row navigation.

How do I easily check a Form Control checkbox value in VBA?

The easiest and most reliable method is to link the checkbox to a cell. Right-click the checkbox, select Format Control, and assign a Cell link. Your VBA code can then simply check if that specific cell's value is TRUE or FALSE.