program multiple elements of a multi dimension array simultaneously

  • Is there any way to do this part of code without calling out each element individually?:



    I know how to use the array() function to program multiple elements of a variant as a single dimension array, but I'd like to be more explicit and I'm not sure how to do it in two dimensions. This kind of array programming is easy in languages like Matlab etc, but there must be some easy way to do it in VBA.


    In Matlab this would look something like this:

    Code
    aSequence = [ 
    -1, 0, 1, 1, 1, 0, -1, -1;
    1, 1, 1, 0, -1, -1, -1, 0;
    ]


    [TABLE="width: 40"]

    [tr]


    [TD="width: 20, align: right"][/TD]
    [TD="width: 20, align: right"]cheers![/TD]

    [/tr]


    [/TABLE]
    Nate

  • Re: program multiple elements of a multi dimension array simultaneously


    VBA

    Code
    aSequence = [{-1,1;0,1;1,1;1,0;1,-1;0,-1;-1,-1;-1,0}]


    Note; Subscript only up to 255 characters and the populated array is always 1 based.
    And the variable must be Variant type.

  • Re: program multiple elements of a multi dimension array simultaneously


    That's EXACTLY what i'm looking for!


    Jindon, you're Legit! thank you.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!