Link Search Menu Expand Document

SSpread.LeaveCell Event

Occurs before moving the active cell.

※ The move is not complete when this event occurs. Use the AfterLeaveCell event when performing processing that is expected after the move is completed.

The following child objects are attached to the Event object.

Type Name Description
Number Col Active cell column number
Number Row Active cell row number
Number NewCol New active cell column number
Number NewRow New active cell row number

It also happens when the SSpread object loses focus. In this case, NewCol and NewRow are -1.

This event does not occur if the OperationMode property is $OperationModeRead (read-only mode).

Also, if move it from the script, the event will not occur.

Example of usage

Function OnLeaveCell (e) {
    if (e.NewCol <0 || e.NewRow <0) {
        return;
    }
    Col = e.Col;
    Row = e.Row;
    BackColor = $ STD;
    Col = e.NewCol;
    Row = e.NewRow;
    BackColor = $ RED;
}

Related Item
AfterLeaveCell event