Re: How to pass a 2-D array into a function?



"Dmitriy Antonov" <antonovdima@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> It has its scope. It is convenient, for example, when "amorphous"
> interface is desired. Consider this general-purpose method, which allows
> you to print (for testing purposes) content of any one-dimensional array
> (only primitive data types).
>
> public sub TestArray(vArray as variant)
> if not isarray(vArray) then exit sub
> dim v as variant
> for each v from vArray
> debug.print v
> next v
> end sub
>
> There are many other possible benefits of using variants as arguments and,
> when used consciously, they allow to create very powerful solutions.

I can see it's use but somehow I don't like that code at all. When I've done
stuff like this I've created a function for each array type, which is
generally only long, double and string.

Michael


.



Relevant Pages

  • Re: Error trying to write array to range
    ... one-dimensional array of strings and that still fails. ... Public Sub MyTest() ... Dim arr() As String ...
    (microsoft.public.excel.programming)
  • Re: how to convert an array
    ... Function one_dim_arrayAs Variant ... 'Converts an argument array of frequencies and values into ... 'a one-dimensional array. ... Dim vR As Variant ...
    (microsoft.public.excel.misc)

Loading