Understanding the ParamArray

The ParamArray argument makes it possible for a procedure (a function or a subroutine) to accept an arbitrary number of arguments, each of a possibly different type. This enables the developer to write a function that will work with one or two or however many arguments that the user of the function passes to it. When used with a User Defined Function (UDF), it works as an Excel function.

image001

For a version in a page by itself (i.e., not in a scrollable iframe as below) visit http://www.tushar-mehta.com/publish_train/xl_vba_cases/1005%20ParamArray.shtml

Tushar Mehta

Posted in Uncategorized

One thought on “Understanding the ParamArray

  1. I tend to use For… Each loops to enumerate paramarrays: this gets ’round the problem of passing a vector or a 2-D array as the paramarray:

    For Each varX In varParamArray

    Next

    This doesn’t get around the problem of receiving a simple scalar variable…

    But the biggest problem is that we can still get a Range, or ranges.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.