---
title: "selectCell(withTag:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmatrix/selectcell(withtag:)"
---

# selectCell(withTag:)

Selects the last cell with the given tag.

## Declaration

```swift
func selectCell(withTag tag: Int) -> Bool
```

## Parameters

- `tag`: The tag of the cell to select.

## Return Value

Return Value true if the receiver contains a cell whose tag matches anInt, or false if no such cell exists

## Discussion

Discussion If the matrix has at least one cell whose tag is equal to anInt, the last cell (when viewing the matrix as a row-ordered array) is selected. If the specified cell is an editable text cell, its text is selected.

## See Also

### Related Documentation

- [cell(withTag:)](appkit/nsmatrix/cell(withtag:).md)
- [selectCell(_:)](appkit/nscontrol/selectcell(_:).md)

### Selecting and Deselecting Cells

- [selectCell(atRow:column:)](appkit/nsmatrix/selectcell(atrow:column:).md)
- [selectAll(_:)](appkit/nsmatrix/selectall(_:).md)
- [keyCell](appkit/nsmatrix/keycell.md)
- [setSelectionFrom(_:to:anchor:highlight:)](appkit/nsmatrix/setselectionfrom(_:to:anchor:highlight:).md)
- [deselectAllCells()](appkit/nsmatrix/deselectallcells().md)
- [deselectSelectedCell()](appkit/nsmatrix/deselectselectedcell().md)
