Fix Excel Selection Jumping to Random Cells After Running a Macro
Question details
The user is experiencing erratic cell selection movements when pressing Enter or Tab immediately after executing an Excel VBA macro that clears ranges.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Navigating a spreadsheet using keyboard shortcuts (Enter/Tab) immediately after running a VBA macro.
- Observed behavior
- Pressing Enter on the numeric keypad or Tab moves the active cell selection to unexpected or random cells instead of the standard adjacent cell.
Before modifying your macro, open the VBA editor and use the 'Compile VBAProject' tool under the Debug menu to identify any existing syntax errors in your code.
Optimize VBA Code by Removing .Select and ActiveCell Commands
The most common cause of erratic cell jumping is the use of .Select or ActiveCell within the macro, which forcibly alters the workbook's focus and cursor position.
When macros are generated using the macro recorder, Excel typically writes code using .Select and ActiveCell. However, these commands physically move the cursor to execute actions. If your macro ends with a specific Range().Select command, your keyboard navigation will start from that new, unexpected location.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor in Excel.
In the Project Explorer pane on the left, double-click the Module containing your clearing macro (e.g., Sub MasterClear).
Look for lines that explicitly select ranges, such as Range("P16:P17").Select or Range("B6").Select.
Modify the code to perform actions directly. For example, combine Range("P16:P17").Select and ActiveCell.FormulaR1C1 = "0" into a single line: Range("P16:P17").Value = 0.
Delete any unnecessary Range().Select commands at the end of your Sub routine that force the cursor to a specific spot.

Verify Multiple Display Compatibility Settings
If optimizing the VBA code does not fully resolve erratic behavior, multi-monitor setups with different scaling settings can occasionally cause Excel UI glitches.
Try WPS Office for a Stable and Smooth Spreadsheet Experience
If Microsoft Excel continues to experience macro-related cursor glitches or software instability despite reinstalling, consider switching to WPS Office. It provides a lightweight, highly compatible spreadsheet environment that handles complex data and daily tasks smoothly.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the software: Run the installer and follow the quick on-screen instructions to set up WPS Office on your computer.
- 3. Open your spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbook directly to continue your work without formatting loss.

Frequently Asked Questions
Why does my Excel cursor jump to a different cell when I press Enter?
This usually happens if a VBA macro explicitly commands the selection to move using the 'Range.Select' method, or if the 'Move selection after Enter' setting in Excel's Advanced Options is set to an unexpected direction (like Up or Left instead of Down).
Do I need to use .Select and ActiveCell in my VBA macros?
No, it is highly recommended to avoid .Select and ActiveCell. You can directly manipulate cells and ranges in VBA. Doing so prevents erratic screen updating, avoids cursor jumping, and dramatically improves the execution speed of your macro.
Can reinstalling Microsoft Office fix macro-related selection issues?
Generally, no. If a macro is causing the selection to jump due to the inherent logic of the VBA code, reinstalling or switching to the 64-bit version of Microsoft 365 will not resolve the issue. The underlying VBA code must be rewritten.




