SET.NAME macro

Defines a name on a macro sheet to refer to a value. The defined name exists only on the macro sheet's list of names and does not appear in the global list of names for the workbook. The SET.NAME function is useful for storing values while the macro is calculating.

Syntax

SET.NAME(name_text, value)

Name_text    is the name in the form of text that refers to value.

Value    is the value you want to store in name_text.

 

Remarks

name_text=value

See the first two examples following.

 

Tips

SET.NAME("OpenDocuments", WINDOWS()) or
SET.NAME("OpenDocuments", {"WORKSHEET1", "WORKSHEET2"})

 

Examples

Each of these formulas defines the name Counter to refer to the constant number 1 on the macro sheet:

SET.NAME("Counter", 1)

Counter=1

Each of these formulas redefines Counter to refer to the current value of Counter plus 1:

SET.NAME("Counter", Counter+1)

Counter=Counter+1

The following macro formula defines the name Reference to refer to cell $A$1:

SET.NAME("Reference", A1)

The following macro formula defines the name Results to refer to the cells $A$1:$C$3:

SET.NAME("Results", A1:C3)

The following macro formula defines the name Range as the current selection:

SET.NAME("Range", SELECTION())

If $A$1 contains the value 2, the following macro formula defines the name Index to refer to the constant value 2:

SET.NAME("Index", DEREF(A1))

Related Functions

DEFINE.NAME   Defines a name on the active worksheet or macro sheet

SET.VALUE   Sets the value of a cell on a macro sheet

Return to index