Microsoft KB Archive/80480

{|
 * width="100%"|

Excel: Referencing Defined Name Returns Macro Error or #REF

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0
 * Microsoft Excel for the Macintosh, versions 2.2, 3.0, 4.0, 5.0

-

SUMMARY
The macro functions INDIRECT and TEXTREF convert text strings that specify defined names on the active worksheet only when the worksheet's name is given in the string. For example, the statement

  =SELECT(INDIRECT(&quot;!name&quot;))

causes the indirect statement to return a #REF! error and the SELECT statement causes the macro to halt. The same result occurs with the statement select(textref(&quot;!name&quot;)).

WORKAROUND
One workaround is to use the macro function GET.NAME in place of INDIRECT or TEXTREF. The macro statement:

  =SELECT(GET.NAME(&quot;!name&quot;))

selects the range defined as 'name' on the active worksheet.

NOTE: The most efficient method to select the range defined by 'name' is to use the statment =SELECT(!name). The other functions described in the article (INDIRECT, TEXTREF, GET.NAME) are alternate methods but are not necessary.

MORE INFORMATION
GET.NAME returns the text of the specified name as it would be displayed in the Refers To box of the Define Name dialog in RC notation. For instance, if the name &quot;test&quot; is defined as $A$1:$A$10, the statement GET.NAME(&quot;test&quot;) returns &quot;=R1C1:R10C1&quot;.

Additional query words: 2.0 2.00 2.01 2.1 2.10 2.20 3.0

Keywords :

Version :

Platform :

Issue type :

Technology :