Explore BrainMass

Using Loops and String Arrays in Excel

I have an assignment due and am having issues with the first part (which is needed to do all of the other parts). I have the following VBA code written:
Private Sub DisplayData(strArray() As String)
Dim intFriend As Integer
For intFriend = 1 To mintNumFriends
Cells(intFriend + 1, 1).Value = strArray(1)
Cells(intFriend + 1, 2).Value = strArray(5)
Cells(intFriend + 1, 3).Value = strArray(6)
Cells(intFriend + 1, 6).Value = strArray(4)
Cells(intFriend + 1, 5).Value = strArray(3)
Cells(intFriend + 1, 4).Value = strArray(2)
Next intFriend

I understand how this works, but I don't know what numbers should be placed into the () for the strArray. The numbers coordinate with 6 pieces of personal information for intFriend 1. They are placed in A2-F2. My problem is that I have no idea how to change this information to apply to all the other friends (the current formula repeats friend 1's information for all the others). For example, friend 2's information involves Arrays 8-13, and friend 3's involes 15-20.
My question is, in a nutshell, what should I place in the () for strArray so that the proper information is placed for each person?
All help is greatly appreciated!

© BrainMass Inc. brainmass.com August 20, 2018, 2:17 pm ad1c9bdddf

Solution Preview

To do this, you must change the argument in such a way that increases the value ...

Solution Summary

This solution discusses and assists with problems that require using loops and string arrays in Excel.