# Working with the Active Cell

Learn how to work with the active cell, set the active cell programmatically, and handle events related to the active cell in Spread.NET

## Content

The active cell is the cell that currently receives any user interaction. The active cell is the single cell that has keyboard focus. There is always an active cell. Usually, the active cell displays some indication that it is in focus.
You can specify the active cell programmatically using the [SetActiveCell](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SetActiveCell.html) method of the [SheetView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.html) class. You can also use the [ActiveCell](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.ActiveCell.html) property to find the active cell coordinates.
The active cell is stored in the [ActiveRowIndex](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.ActiveRowIndex.html) and [ActiveColumnIndex](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.ActiveColumnIndex.html) properties in the SheetView class. The [LeaveCell](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.LeaveCell.html) event is raised any time the active cell changes.
You can change the focus indicator; for more information, refer to [Customizing the Focus Indicator for a Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cell-indicators/spwin-cellfocusind).
The cell selection is one or more cells that have been highlighted by the user or application. At any given time, there may or may not be a cell selection present. The cell selection (if present) is stored in the selection model inside the SheetView class. The [Changed](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Model.BaseSheetSelectionModel.Changed.html) event (in the selection model) is raised any time the cell selection changes.
Spread Windows Forms has two implementations of selection coloring. When the [SelectionStyle](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SelectionStyle.html) property is set to SelectionColors, the cell is painted using selection colors (that is, both SelectionBackColor and SelectionForeColor). When the **SelectionStyle** property is set to SelectionRenderer (which is the default), the cell is painted using normal coloring and then over painted with the SelectionRenderer. The default SelectionRenderer uses a semi-transparent version of the system's selection color.
In RowMode, which is an operation mode where only rows can be selected, there is an active cell. The active row is painted similar to a selected row.
Spread Windows Forms uses a painting scheme similar to Excel. If the cell is the active cell then the cell is painted using normal coloring and a focus box. If the cell is selected then the cell is painted using selection coloring, or else the cell is painted using normal coloring.
There is a different painting scheme in OpenOffice. If the cell is both the active cell and a selected cell then the cell is painted using selection coloring and a focus box. Spread Windows Forms does not support OpenOffice's painting scheme.
You can change what can be selected by the user. For more information, refer to [Specifying What the User Can Select](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-interactselection/spwin-selsetuser). You can also customize how the selection appears. For more information, refer to [Customizing the Selection Appearance](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-interactselection/spwin-selsetappear).

## Using a Shortcut

You can use [ActiveCell](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.ActiveCell.html) as a shortcut object for the active cell when specifying properties of that cell. Use the [SetActiveCell](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SetActiveCell.html) to set the active cell.

## Example

Set the active cell and do not clear previously selected cells.

```csharp
fpSpread1.ActiveSheet.SetActiveCell(2, 2, false);
```

```vbnet
fpSpread1.ActiveSheet.SetActiveCell(2, 2, False)
```

## See Also

[Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell)
[Creating a Range of Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-cellrange)
[Managing Data on a Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-usedata)
[Displaying Cell Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-celldata)
[Creating a Span of Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-cellspan)
[Allowing Cells to Merge Automatically](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-cellmerge)
[Adding a Note to a Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-cell-note)
[Adding a Tag to a Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-tags-cell)
[Displaying Text Tips in a Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-cell-texttip)
[Working with Pattern and Gradient Fill Effects](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-patternandgradientfill)