?
Solved

Multi-Dimensional Array

Posted on 2003-03-02
3
Medium Priority
?
145 Views
Last Modified: 2010-08-05
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.
0
Comment
Question by:Blackmere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 300 total points
ID: 8055054
First with VB arrays all indexes are numeric.

Dim MyScores(5) as integer

Creates an array of 6 elements (0-5) of integers.

MyScores(0) = 100

Similarly for multidimensioned arrays

Dim Names(10,6) as string

Names(0,0) = "Jim"

mlmcc
0
 
LVL 3

Expert Comment

by:DocM
ID: 8055081
If you are working with an Excel sheet,
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
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8055098
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
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question