Fired before the current cell changes to a different cell.
Public Event BeforeRowColChange(ByVal OldRow As Long, ByVal OldCol As Long, ByVal NewRow As Long, ByVal NewCol As Long, ByRef Cancel As Boolean)
Grid Object
The following parameters are available:
Parameter | Description |
OldRow | Row number of cell losing the focus. |
OldCol | Column number of cell losing the focus. |
NewRow | Row number of cell receiving the focus. |
NewCol | Column number of cell receiving the focus. |
Cancel | Set this value to True to prevent the focus from moving. |
This event gets fired before the CurrentRowIndex and CurrentColIndex properties change, either as a result of user actions or through code. It allows you to prevent the selection of certain cells, thus creating "protected" ranges on a grid.
BeforeRowColChange It is fired only when the CurrentRowIndex and CurrentColIndex property are about to change. To prevent the extended selection of a range, you also need to handle the BeforeSelChange event.