ApplyNames Method

Applies To

Range Object.

Description

Applies names to the cells in the range.

Syntax

object.ApplyNames(names, ignoreRelativeAbsolute, useRowColumnNames, omitColumn, omitRow, order, appendLast)

object

Required. The range where names will be applied.

names

Optional. Contains an array of the names to apply. If omitted, all names on the sheet are applied to the range.

ignoreRelativeAbsolute

Optional. If True or omitted, replaces references with names regardless of the reference types of either the names or references. If False, replaces absolute references only with absolute names, relative references only with relative names, and mixed references only with mixed names.

useRowColumnNames

Optional. If True or omitted, Microsoft Excel uses the names of row and column ranges containing the specified range if names for the range cannot be found. If False, the omitColumn and omitRow arguments are ignored.

omitColumn

Optional. If True or omitted, Microsoft Excel replaces the reference with the row-oriented name without including a column-oriented name if the referenced cell is in the same column as the formula and within a row-oriented named range.

omitRow

Optional. If True or omitted, Microsoft Excel replaces the reference with the column-oriented name without including a row-oriented name if the referenced cell is in the same row as the formula within a column-oriented named range.

order

Optional. Determines which range name is listed first when a cell reference is replaced by a row-oriented and column-oriented range name (either xlRowThenColumn or xlColumnThenRow).

appendLast

Optional. If True, Microsoft Excel replaces the definitions of the names in names and also replaces the definitions of the last names defined. If appendLast is False or omitted, Microsoft Excel replaces the definitions of the names in names only.

Remarks

You can use the Array function to create the list of names for the names argument.

If you want to apply names to the entire sheet, use Cells.ApplyNames.

You cannot "unapply" names; to delete names, use the Delete method.

See Also

Add Method (Names Collection), Delete Method.

Example

This example applies names to the entire sheet.


Cells.ApplyNames names:=Array("Sales", "Profits")