Definition and use of multi-dimensional variables
Try using a multi-dimensional array... a quick example would be:
Sub test()
Dim myarray(1 To 10, 1 To 3) As Variant
Dim i As Integer, x As Integer, j As Integer
For i = 1 To 10 Step 1
myarray(i, 1) = "My Name" & i
myarray(i, 2) = "My Title" & i
myarray(i, 3) = i
Next i
For x = 1 To 10 Step 1
For j = 1 To 3 Step 1
Debug.Print myarray(x, j)
Next j
Next x
End Sub
Try it out (make sure that the immediate window is visible)
HTH
Sandy
On Nov 20, 1:45 pm, "Arthur Negus via OfficeKB.com" <u5428@uwe wrote:
I want to define and use multi-dimensional variables.
I can define variables of type variant (i.e. Dim field() as variant), and
then refine them by using: Redim field(1 to i); to build i variables (field(1)
, field(2) ... field(i)) in variant field.
What I want to do now is define the variables field(1), field(2) etc. to ...
field(i), such that each 'field(i)' variable contains ~4 sub-variables. i.e:
field - field(1) - (fldRange as Range
Name As String
Title As String
index As Integer, etc.
field(2) - fldRange as Range
Name As String
Title As String
index As Integer,
etc; to ..................
field(i) - fldRange as Range
Name As String
Title As String
index As Integer
Is this possible, and can anyone explain how I can do this?
--
Message posted viahttp://www.officekb.com
|