If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Create array name dynmamically in Excel VBA

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-06, 12:56
NewVBA NewVBA is offline
Registered User
 
Join Date: Jun 2006
Posts: 5
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 12:59.
Reply With Quote
  #2 (permalink)  
Old 06-08-06, 15:06
norie norie is offline
Registered User
 
Join Date: Mar 2006
Posts: 163
You can't dynamically create variable names in VBA.

What are you trying to achieve?
Reply With Quote
  #3 (permalink)  
Old 06-09-06, 00:38
mkggoh mkggoh is offline
Registered User
 
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)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On