# Working with Selections of Cells

Use Spread for ASP.NET to work with selections to the spreadsheet using code. Learn more in documentation.

## Content

Besides selections that can be allowed by the end user, you can work with selections to the sheet using code. With code, you can add a selection or remove one or all of the existing selections. Use the [AddSelection](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.Model.DefaultSheetSelectionModel.AddSelection.html) and [ClearSelection](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.Model.DefaultSheetSelectionModel.ClearSelection.html) methods to add and remove selections using code in the selection model.
For more information on working with the models, refer to [Understanding the Selection Model](/spreadnet/docs/latest/online-asp/overview/spweb-devguide/spweb-usemodels/spweb-model-specifics/spweb-model-selectstuff).
For information on changing the appearance of selected cells, refer to [Customizing the Appearance of Selections](/spreadnet/docs/latest/online-asp/overview/spweb-devguide/spweb-interaction/spweb-interact-selection/spweb-selsetappear).

## Using Code

You can get a selection on the server side with the following code.

## Example

The following code gets the first selection.

```csharp
FarPoint.Web.Spread.Model.CellRange cr = FarPoint.Web.Spread.Model.CellRange;
cr = FpSpread1.Sheets[0].SelectionModel(0);
```

```vbnet
Dim cr as FarPoint.Web.Spread.Model.CellRange
cr = FpSpread1.Sheets(0).SelectionModel(0)
```