- 3 minutes to read
A Name Box is a part of the formula bar (SpreadsheetFormulaBar) that displays a reference to the currently active cell. If a cell range selected in a worksheet has a name, the name box displays the range name, as well as a table, picture or chart name when the corresponding object is selected. The name box also allows end-users to create workbook level defined names for cells, and quickly navigate to cells by their references and names.
To display or hide the name box in your application, use the SpreadsheetFormulaBar.ShowNameBox property. This property is true by default.
Below is the list of capabilities provided by the name box.
Obtain an active cell reference
The name box displays a reference of the current active cell.
Select cells by references
Name box allows selecting cells in a worksheet by their references, without using the mouse or keyboard shortcuts.
How to implement the operation
Select a cell range in the active worksheet
Type the cell range reference in the name box and press the Enter key.
Select a cell range in any worksheet in the current workbook
In the name box, type the worksheet name before the cell reference, separating them with an exclamation point (!), and press the Enter key.
Select multiple ranges simultaneously
In the name box, type cell range references, separating them with commas, and press the Enter key.
Control the number of rows and columns while selecting a cell range with the mouse
The name box displays the number of rows and columns currently selected while an end-user is selecting cells and the left mouse button is being pressed.
Create workbook level names for cells
One of the ways to create a name for a cell range is to use the name box, following the steps below.
- Select a cell range to be named.
- Click the name box (by default, it shows the reference of the active cell).
- Type the desired name (the Defined Names document lists the syntax rules for names). Note that a name cannot be entered into the name box while cell content is being edited.
- Press the Enter key.
To create defined names more flexibly (for example, specify a formula or constant to be associated with the defined name, or set an individual worksheet to be the scope of the name, or accompany the name with a comment), the New Name dialog can be used. Defined names for cell ranges can also be automatically generated from values in the selected cells via the Create Names from Selection dialog.
Select cells by names
Name box allows selecting cells in a worksheet by their names. In the name box, type or select from the drop-down list an existing cell range name, and press the Enter key.
Obtain the selected table, picture or chart name
The name box displays the name of the table, picture or chart currently selected in the SpreadsheetControl.