I have a Worksheet_SelectionChange event that selects the row to the left of and including the active cell, as well as the column above and including the active cell, with the active cell remaining the original cell.
Problem: When I type something in the active cell and Enter, instead of moving one cell down (which is what is required) it jumps to the start of the selection, as per normal. How can I programmatically change this behaviour so that the cell immediately below the active cell (i.e. the corner of the selection) becomes the new active cell?
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lngRows As Long, lngCols As Long
Dim CornerCell As Range
lngRows = Selection.Rows.Count
lngCols = Selection.Columns.Count
If lngRows > 1 Or lngCols > 1 Then Exit Sub
Set CornerCell = ActiveCell
Application.EnableEvents = False
Union(Range(Cells(CornerCell.Row, 1), Cells(CornerCell.Row, CornerCell.Column)), _
Range(Cells(1, CornerCell.Column), Cells(CornerCell.Row, CornerCell.Column))).Select
CornerCell.Activate
Application.EnableEvents = True
End Sub
Regards,
Henk Stander
Bookmarks