BeforeColEdit Event

       

Occurs just before the user enters edit mode by typing a character.

Syntax

Private Sub object_BeforeColEdit([ index As Integer,] ByVal colindex As Integer, ByVal keyascii As Integer, cancel As Integer)

The BeforeColEdit event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
Index An integer that identifies a control if it is in a control array.
colindex An integer that identifies the column to be edited.
keyascii An integer representing the ANSI key code of the character typed by the user to initiate editing, or 0 if the user initiated editing by clicking the mouse. KeyAscii is passed by value, not by reference; you cannot change its value to initiate editing with a different character.
cancel An integer that may be set to True to prevent the user from editing the cell, as described in Settings.

Settings

The settings for cancel are:

Setting Description
True The cell will not enter edit mode
False (Default) The ColEdit event is fired immediately, followed by the Change and KeyUp events for the KeyAscii argument, if non-zero.

Remarks

If a floating editor marquee is not in use, this event also occurs when the user clicks the current cell or double clicks another cell.

Use this event to control the editability of cells on a per-cell basis, or to translate the initial keystroke into a default value.

Note   The keyascii argument can only be 0 if a floating editor marquee is not in use.