Blackmere
asked on
Multi-Dimensional Array
Ok, I'm trying to get this format into an array
A B C D
1 Jim
2
3
4
5
6 Christina
7 Paul
8
9
10
Where I can select items to put into my array like a class seating chart. A1 = Jim, C7 = Paul, B6 = Christina.
I've been trying diffrent thing and can't get anything to work. I'm trying to turn it into a multi-dimensional array.
A B C D
1 Jim
2
3
4
5
6 Christina
7 Paul
8
9
10
Where I can select items to put into my array like a class seating chart. A1 = Jim, C7 = Paul, B6 = Christina.
I've been trying diffrent thing and can't get anything to work. I'm trying to turn it into a multi-dimensional array.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, first off, that is going to be a 2 dimensional array, which can be declared by
Private Enum Names
A = 0
B = 1
C = 2
'ect
End Enum
Private fName As Names
Private Sub Form_Load()
Dim array1() As String
inI = 3
ReDim array1(1 To inI, A To C) As String
Open App.Path + "\Text.txt" For Input As #1
For inJ = 1 To inI
For inL = A To C
Input #1, array1(inJ, inL)
Picture1.Print array1(inJ, inL)
Next inL
Next inJ
I hope this is what you are looking for.
Jacamar
Private Enum Names
A = 0
B = 1
C = 2
'ect
End Enum
Private fName As Names
Private Sub Form_Load()
Dim array1() As String
inI = 3
ReDim array1(1 To inI, A To C) As String
Open App.Path + "\Text.txt" For Input As #1
For inJ = 1 To inI
For inL = A To C
Input #1, array1(inJ, inL)
Picture1.Print array1(inJ, inL)
Next inL
Next inJ
I hope this is what you are looking for.
Jacamar
you can do this:
ReDim myArray(9, 2)
For r = 1 To 10 'Read rows 1 to 10
For c = 1 To 3 'Read Columns A to C
myArray(r - 1, c - 1) = Cells(r, c).Value
Next
Next