Microsoft KB Archive/26066

{| = Excel: SET.VALUE, SET.NAME, and DEFINE.NAME Differences =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q26066

SUMMARY
The following is a description of the differences among the Microsoft Excel macro functions SET.NAME, SET.VALUE, and DEFINE.NAME.

MORE INFORMATION
SET.VALUE is a macro control function that places specific value(s) directly into cell(s) on the macro sheet, whether the macro sheet is active or not. For example, the formula =SET.VALUE(C2,34.7) on a macro sheet titled &quot;Macro1&quot; will enter 34.7 into cell C2 on the &quot;Macro1&quot; macro sheet.

SET.NAME is a macro control function that defines a variable name to be associated with a certain value on the macro sheet. The variable name can then be used in other macro statements to represent this value. For example, the following set of macro steps sets the value 2 to be associated with the name &quot;test&quot;:

=SET.NAME(&quot;test&quot;,2) =FORMULA(test) This value is then placed into the active cell on the active worksheet. The macro sheet does not have to be active to use SET.NAME. DEFINE.NAME is a command-equivalent macro function that attaches a name to a cell category, value, or formula on the active worksheet or macro sheet. This name can then be used in place of the cell category or other value. For example, the following macro steps associate the name &quot;answer&quot; with cell $B$2 on the active worksheet and then place a formula, which divides this value by 100, into the active cell:

=DEFINE.NAME(&quot;answer&quot;,!$B$2) =FORMULA(&quot;=answer/100&quot;) The difference between SET.NAME and DEFINE.NAME is that SET.NAME can only define names on a macro sheet, and DEFINE.NAME always defines a name on the active window, whether the active window is a worksheet or macro sheet. For more information regarding SET.NAME, DEFINE.NAME, and SET.VALUE, see pages 48-49, 217-218, and 220-221 in the &quot;Microsoft Excel Function Reference&quot; version 3.0 manual. If you are using Excel 2.20, see pages 209-210, 279-280, and 281 in the &quot;Microsoft Excel Functions and Macros&quot; version 2.2 manual.
 * }