How to Move Excel Selection Across a Specific Range Using VBA
Question details
The user wants to configure the spreadsheet so that pressing the Enter key moves the active cell selection from left to right within a specific range (e.g., A1:F3), then automatically jumps down to the start of the next row.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Entering data sequentially across multiple columns and rows within a restricted grid, requiring an efficient way to wrap around to the next row without manual clicking.
- Observed behavior
- By default, pressing Enter moves the cell selection downward indefinitely, ignoring custom row boundaries unless the user manually redirects the cursor.
If you decide to use the VBA method, ensure that the Developer tab is enabled in your ribbon and that your workbook is saved as a Macro-Enabled Workbook (.xlsm).
Use Built-in Excel Options for Data Entry (No VBA Required)
The simplest and fastest way to restrict selection movement to a specific range without writing any code.
Navigate to File > Options > Advanced. Under the 'Editing options' section, ensure 'After pressing Enter, move selection' is checked, and set the Direction to 'Right'. Click OK.
Using your mouse, highlight the entire grid where you want to enter data (for example, A1:F3). The first cell (A1) will be the active cell, highlighted in a lighter color.
Begin typing your data and press Enter after each entry. The selection will automatically move left to right. Once it reaches the end of the selected row, it will automatically wrap around to the first column of the next row.

Use VBA Worksheet Events for Automated Movement
Use this method to permanently enforce the cursor movement rules for a specific worksheet without needing to manually pre-select the range each time.
Automate Data Entry with WPS Spreadsheet
WPS Spreadsheet fully supports Excel VBA (Macros) and advanced options, allowing you to seamlessly configure cursor movements for faster data entry. You can use the exact same built-in settings or VBA code in WPS Office.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your spreadsheet file.
- 2. Adjust Edit Settings: Go to Menu > Options > Edit, and change the 'Move selection after Enter' direction to 'Right'.
- 3. Select the Range: Highlight your target range (e.g., A1:F3) and start typing. Press Enter to instantly move across columns and automatically wrap to the next row.

Frequently Asked Questions
How do I change the Enter key direction back to moving down?
Go to File > Options > Advanced. Under 'Editing options', look for 'After pressing Enter, move selection' and change the Direction dropdown from 'Right' back to 'Down', then click OK.
Why does my VBA cursor wrap-around code stop working if I move my grid?
If you change your target grid location (for instance, moving from A1:F3 to G3:K8), your VBA code is still looking for the original cell addresses. You must manually open the VBA Editor and update the 'Intersect' column references, as well as the 'Target.Offset' values to reflect the new number of columns in your grid.
Do I have to use VBA to restrict data entry to a specific block of cells?
No. By simply pre-selecting the block of cells with your mouse before you start typing, and ensuring your Enter direction is set to 'Right', Excel will automatically contain your movements within that highlighted block without needing any VBA macros.




