List Arrays of a Certain Size

G

Guest

I have a subroutine that uses a two-dimensional array to get data with which
I create a complicated chart. I would like to use this same subroutine on
about 25 other arrays of similar size, by just varying the name of the array
used by the subroutine. I am thinking of creating a listbox showing active
two-dimensional arrays, and plugging the chosen array name into the
subroutine. How would I get VBA to create a list of two-dimensional arrays
that currently exist in memory so that I could feed that list into a listbox?
Any ideas will be appreciated.
 
R

RB Smissaert

How about something like this:

Sub test()

Dim coll As Collection
Dim arr1(1 To 100, 1 To 5) As Long
Dim arr2(1 To 100, 1 To 6) As Long
Dim arrGraph

Set coll = New Collection

coll.Add arr1
coll.Add arr2

arrGraph = coll(UserForm1.ListBox1.ListIndex)

End Sub

RBS
 
M

Mickey Mouse

RB Smissaert said:
How about something like this:

Sub test()

Dim coll As Collection
Dim arr1(1 To 100, 1 To 5) As Long
Dim arr2(1 To 100, 1 To 6) As Long
Dim arrGraph

Set coll = New Collection

coll.Add arr1
coll.Add arr2

arrGraph = coll(UserForm1.ListBox1.ListIndex)

End Sub

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top