Excel: Returning a Horizontal Array from a Function Macro

Last reviewed: November 29, 1994
Article ID: Q62278
The information in this article applies to:
  • Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.0, 4.0

SUMMARY

When a function macro computes more than one value, the computed values may be returned as an array.

Because of function macro limitations and the strict order of calculation followed for macro sheets, it is difficult to arrange computed values horizontally. This can be done with multiple GOTO statements in the macro, but it is more convenient to return the values as a vertical array. A sample RETURN statement might appear as follows:

   =RETURN(A12:A15)

On the worksheet, however, it is sometimes desirable to horizontally enter the results computed by a function macro. This can be done with the TRANSPOSE function as follows:

  1. Select the appropriate number of cells in a row and type a formula of the following form:

          =TRANSPOSE(Macrosheet!functionmacro(arg1,arg2,...))
    

  2. Press COMMAND+ENTER to enter the formula as an array. The vertical array returned by the function macro will be entered along the row.


KBCategory: kbusage
KBSubcategory:

Additional reference words: 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.2
2.20 3.0 3.00 4.0 4.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 29, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.