The information in this article applies to:
SUMMARY
The most common way to transfer the contents of a named array to a
worksheet is through a loop such as a For Next loop. A For Next loop
indexes the array and inserts one element of the array to the
destination address at a time.
MORE INFORMATION
Microsoft provides examples of Visual Basic procedures for illustration
only, without warranty either expressed or implied, including but not
limited to the implied warranties of merchantability and/or fitness for a
particular purpose. This Visual Basic procedure is provided 'as is' and
Microsoft does not guarantee that it can be used in all situations.
Microsoft does not support modifications of this procedure to suit customer
requirements for a particular purpose. Note that a line that is preceded by
an apostrophe introduces a comment in the code--comments are provided to
explain what the code is doing at a particular point in the procedure. Note
also that an underscore character (_) indicates that code continues from
one line to the next. You can type lines that contain this character as one
logical line or you can divide the lines of code and include the line
continuation character. For more information about Visual Basic for
Applications programming style, see the "Programming Style in This Manual"
section in the "Document Conventions" section of the "Visual Basic User's
Guide."
The above example works fine when the destination worksheet cells involve
one row. However, when the contents of an array need to be transferred to a
range of cells with a vertical, as opposed to a horizontal orientation
(that is, one column by several rows), the above example is no longer
valid.
In the event that multiple rows of data are within the two-dimensional array, you must change the orientation of the array. To do this, you can declare the array a two-dimensional array with dimensions of several rows by one column. For example:
The two-dimensional array shown in this example allows Visual Basic to set
the orientation of the array as vertical; therefore, the array can be
transferred to a worksheet without a loop.
REFERENCESFor more information about FormulaArray choose the Search button in Visual Basic Help and type: FormulaArray Additional query words:
Keywords : kbprg |
Last Reviewed: October 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |