Excel: Referencing Defined Name Returns Macro Error or #REFLast reviewed: November 30, 1994Article ID: Q80480 |
The information in this article applies to:
SUMMARYThe 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("!name"))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("!name")).
WORKAROUNDOne workaround is to use the macro function GET.NAME in place of INDIRECT or TEXTREF. The macro statement:
=SELECT(GET.NAME("!name"))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 INFORMATIONGET.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 "test" is defined as $A$1:$A$10, the statement GET.NAME("test") returns "=R1C1:R10C1".
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |