Override the End Key in Excel to Go to the Last Populated Cell
Question details
The user wants the End key to move directly to the last populated cell instead of activating Excel's End mode.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Navigating a worksheet with the End key.
- Observed behavior
- Pressing End activates End mode, after which an arrow key is needed to move through the data region.
This VBA method requires a desktop version of Excel that supports macros. If you do not already have PERSONAL.XLSB, create it by recording a short macro with Store macro in set to Personal Macro Workbook, then stop recording.
Remap End with a macro in PERSONAL.XLSB
Use VBA to make End select the last cell containing a value or formula in the current row.
Excel has no built-in setting to permanently change End mode. This macro changes the key's behavior in worksheets while the assignment is active; it does not change how End works when editing cell text.
In desktop Excel, open the VBA editor with Alt+F11 or Developer > Visual Basic. In the Project Explorer, find VBAProject (PERSONAL.XLSB).
Select VBAProject (PERSONAL.XLSB), choose Insert > Module, and paste: Sub MyEndKey() Dim ws As Worksheet Dim target As Range Set ws = ActiveSheet Set target = ws.Rows(ActiveCell.Row).Find(What:="*", After:=ws.Cells(ActiveCell.Row, 1), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False, SearchFormat:=False) If Not target Is Nothing Then target.Select End Sub
Under VBAProject (PERSONAL.XLSB), double-click ThisWorkbook and add: Private Sub Workbook_Open() Application.OnKey "{END}", "'PERSONAL.XLSB'!MyEndKey" End Sub
Save PERSONAL.XLSB in the VBA editor, close Excel, and reopen it. Enable macros if prompted, then select a worksheet cell and press End to test the shortcut.

Use Ctrl and an arrow key to navigate a data region
Use Excel's standard shortcut if you prefer not to change the End key or enable macros.
Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative for working with spreadsheets in a familiar interface. Open compatible Excel files and continue working without a complex migration; it does not change Microsoft Excel's End key behavior.

Frequently Asked Questions
Can I change Excel's End key behavior without VBA?
Excel does not offer a built-in setting to permanently remap End. Without a macro, use Ctrl+Arrow to move to the edge of a data region.
What happens if the current row is empty?
The macro's Find operation returns no cell, so pressing End leaves the active cell unchanged.
Does the macro find cells containing formulas?
Yes. The macro uses LookIn:=xlFormulas, so it can find a cell containing a formula even if the formula displays an empty result.
Why does the End key still activate End mode after restarting?
Check that the macro is in a regular module in PERSONAL.XLSB, the Application.OnKey assignment is in its ThisWorkbook module, and macros are enabled. Save PERSONAL.XLSB and restart Excel again.
Does remapping End change its behavior while I edit a cell?
No. The VBA assignment is intended for worksheet navigation; it does not change the End key's text-editing behavior inside a cell.




