Hi there,
You can create your own Type variable, here is an example...
Option Explicit
Public Type Field
Range As Range
Name As String
Title As String
Index As Long
End Type
Sub TestMyType()
'Declare variables
Dim myField1 As Field, myField2 As Field, myField3 As Field, v
'Set first field variable
myField1.Index = 1
myField1.Name = "My First Variable Name"
myField1.Range = Range("A1")
myField1.Title = "VAR TITLE1"
'Set second field variable
myField2.Index = 2
myField2.Name = "My Second Variable Name"
myField2.Range = Range("A2")
myField2.Title = "VAR TITLE2"
'Set third field variable
myField3.Index = 3
myField3.Name = "My Third Variable Name"
myField3.Range = Range("A3")
myField3.Title = "VAR TITLE3"
End Sub
The other option could be to just make a two-dimensional array...
Dim arrField(1 to i, 1 to 4)
HTH
--
Regards,
Zack Barresse, aka firefytr
"Arthur Negus via OfficeKB.com" <u5428@uwe> wrote in message
news:6994e3b85fb4c@uwe...
>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 via http://www.officekb.com
>