DEFINE.NAME

Macro Sheets Only

Equivalent to choosing the Define command from the Name submenu on the Insert menu. Defines a name on the active sheet or macro sheet. Use DEFINE.NAME instead of SET.NAME when you want to define a name on the active sheet.

Syntax

DEFINE.NAME(name_text, refers_to, macro_type, shortcut_text, hidden, category, local)
DEFINE.NAME?
(name_text, refers_to, macro_type, shortcut_text, hidden, category, local)

Name_text is the text you want to use as the name. Names cannot include spaces, and cannot look like cell references.

Refers_to describes what name_text should refer to, and can be any of the following values.

If refers_to is Then name_text is

A number, text, or logical value

Defined to refer to that value

An external reference, such as !$A$1 or SALES!$A$1:$C$3

Defined to refer to those cells

A formula in the form of text, such as "=2*PI()/360" (if the formula contains references, they must be R1C1-style references, such as
"=R2C2*(1+RC[-1])")

Defined to refer to that formula

Omitted

Defined to refer to the current selection


The next two arguments, macro_type and shortcut_text, apply only if the sheet in the active window is a macro sheet.

Macro_type is a number from 1 to 3 that indicates the type of macro.

Macro_type Type of macro

1 Custom function (also known as a function macro)

2 Command macro.

3 or omitted None (that is, name_text does not refer to a macro)

Shortcut_text is a text value that specifies the macro shortcut key. Shortcut_text must be a single letter, such as "z" or "Z".

Hidden is a logical value specifying whether to define the name as a hidden name. If hidden is TRUE, Microsoft Excel defines the name as a hidden name; if FALSE or omitted, Microsoft Excel defines the name normally.

Category is a number or text identifying the category of a custom function and corresponds to categories in the Function Category list box.

Local is a logical value which, if TRUE, defines the name on just the current sheet or macro sheet. If FALSE or omitted, defines the name for all sheets in the workbook.

Remarks

Related Functions

DELETE.NAME Deletes a name

GET.DEF Returns a name matching a definition

GET.NAME Returns the definition of a name

NAMES Returns the names defined in a workbook

SET.NAME Defines a name as a value

List of Command-Equivalent Functions