I have a macro which has two loops looking through a spreadsheet which then list the desired data in another sheet. The first loop searchs through the list for a part name (ie, part1, part2, etc.) I call this the i loop. The second loop, called loop j, then search for all the body subcomponents of the parts. So Part1 may have body1, body2, and body3, then Part2 may contain Body1, Body2, and Part3 may contain multiple bodies as well. On my new sheet I am creating I want to list each part then their subsequent bodies like so...
Row 1. Part1
Row 2. Body1
Row 3. Body2
Row 4. Body3
Row 5. Part2
Row 6. Body1
Row 7. Body2
Row 8. Part3
and so on... I am not sure of the formulas for the loops to display the desired result above. Understand what I am getting at? Here is an example of my loop commands:
For i=1 to NumberofParts
Excel.Cells(i+1,1)=partName
For j=1 to NumberofBodies
Excel.Cells(J+1,1)=namebody
Next 'j
Next 'i
Row 1. Part1
Row 2. Body1
Row 3. Body2
Row 4. Body3
Row 5. Part2
Row 6. Body1
Row 7. Body2
Row 8. Part3
and so on... I am not sure of the formulas for the loops to display the desired result above. Understand what I am getting at? Here is an example of my loop commands:
For i=1 to NumberofParts
Excel.Cells(i+1,1)=partName
For j=1 to NumberofBodies
Excel.Cells(J+1,1)=namebody
Next 'j
Next 'i