Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    5

    Unanswered: Create array name dynmamically in Excel VBA

    I want to create the name of a 2-D array based on the counter number on a loop or activate a particular array based on the counter number. Any help is much appreciated.

    E.g.

    Dim M1(! To 5, 1 To 5) As Single
    Dim M2(! To 5, 1 To 5) As Single
    Dim M3(! To 5, 1 To 5) As Single
    Dim M4(! To 5, 1 To 5) As Single

    'X is the counter / array no. i is the row number in the array, j the column no

    For X = 1 To 4
    For i = 1 To 5
    For j = 1 To 5

    M & "X" (i,j) = .....

    Next j
    Next i
    Next X
    Last edited by NewVBA; 06-08-06 at 13:59.

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    You can't dynamically create variable names in VBA.

    What are you trying to achieve?

  3. #3
    Join Date
    Jun 2006
    Posts
    103
    Er....in Java u can use Vector, I am not sure in VBA can use Collection or not. come to the worst, make one for yourself based on Link-List theory. (ie: alot code to write)

Posting Permissions

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