+ Reply to Thread
Results 1 to 3 of 3

Referring to multiple elements of an array (VB)

  1. #1
    Phil
    Guest

    Referring to multiple elements of an array (VB)

    Hi, is there a way to refer to multiple elements of an array in a
    single instruction, without of course having to loop through the array?
    Like in Matlab where one could, for example, refer to first "n"
    elements of the second column of an array simply using:
    array_example(1:n,2).
    thnx for help,

    Phil


  2. #2
    Peter T
    Guest

    Re: Referring to multiple elements of an array (VB)

    Hi Phil

    You could take assign a horizontal or vertical slice of an array to a
    variant

    va = application.index(myArray, row)
    va = application.index(myArray, ,col)

    But I don't know any way to directly refer to a segment of an array's row or
    column, I don't think possible.

    I'm not sure this index method would be any quicker than looping, I suspect
    not. Also would error in xl2000 if total number of elements exceeds 5461

    Regards,
    Peter T

    "Phil" <fitagle@gmail.com> wrote in message
    news:1131914441.880813.242830@o13g2000cwo.googlegroups.com...
    > Hi, is there a way to refer to multiple elements of an array in a
    > single instruction, without of course having to loop through the array?
    > Like in Matlab where one could, for example, refer to first "n"
    > elements of the second column of an array simply using:
    > array_example(1:n,2).
    > thnx for help,
    >
    > Phil
    >




  3. #3
    Phil
    Guest

    Re: Referring to multiple elements of an array (VB)

    Pete, thanks for the insight. Combining the "index" function with
    dynamic arrays did the trick.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1