Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming arrays with for loop?

Status
Not open for further replies.

chrismech91

Nuclear
Feb 21, 2013
6
GR
Dim MainArray(999,3)

Dim i As integer
For i = 1 to partcount

Set MainArray(i-1,0) = products1.Item(i) 'The first row of the MainArray consists of the products of the PPR

Next

Dim P0(11)
MainArray(0,0).Position.GetComponents P0 'Using the GetComponents method an array named P0 is created and contains the coordinates of the product MainArray(0,0)

MainArray(0,1)=P0(9)
MainArray(0,2)=P0(10)
MainArray(0,3)=P0(11)

This is a part of my code that works fine, but i want it to work
From P0 to P(partcount) and i wonder if i can use a for loop at the name of the array?

Something like that:

For i=1 To partcount

Dim P"i"(11)
MainArray(i,0).Position.GetComponents P"i"

MainArray(i,1)=P"i"(9)
MainArray(i,2)=P"i"(10)
MainArray(i,3)=P"i"(11)

Next

Any help or alternative choice would be very helpful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top