Skip to main content

SpreadsheetControl.ActiveCell Property

Returns an active cell in the active worksheet.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.2.dll

Declaration

[Browsable(false)]
public Cell ActiveCell { get; }

Property Value

Type Description
Cell

Specifies an active cell.

Remarks

The SpreadsheetControl.Selection property specifies the selected cell range in the active worksheet (for instance, B3:F9 in the image below). The SpreadsheetControl.SelectedCell property specifies an active cell where data is inserted when a user types (E7 in the image below). Use the ActiveCell property to obtain this cell. Selection can be a cell or cell range, while SelectedCell is always a single cell within the current selection.

SpreadsheetControl_Worksheet_Selection

The following code specifies the cell selection and an active cell as shown in the image above.

using DevExpress.Spreadsheet;
// ...

IWorkbook workbook = spreadsheetControl1.Document;
Worksheet activeSheet = workbook.Worksheets.ActiveWorksheet;

// Specify the selected range in the active worksheet.
spreadsheetControl1.Selection = activeSheet.Range["B3:F9"];
// Specify an active cell in the active worksheet.
spreadsheetControl1.SelectedCell = activeSheet.Cells["E7"];

Note

You can also use the Worksheet.Selection and Worksheet.SelectedCell properties to specify the selected range and active cell in a worksheet.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveCell property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also