How to Require an Excel Checkbox Selection Before Moving to the Next Row
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.

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

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. Open WPS Spreadsheet: Launch WPS Office and open your workbook.
- 2. Access Developer Tools: Navigate to the Developer tab on the top ribbon to access form controls.
- 3. Launch the VBA Editor: Click 'Visual Basic' to open the editor and paste your Worksheet_SelectionChange code.
- 4. Save with Macros: Save your file as an XLSM format seamlessly without losing functionality.

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.




