View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Declare Variables in Array

or simply

Public Type MyUDT
MyLong As Long
MyString As String
MyInteger As Integer
MyVariant As Variant
End Type

Sub Test()
Dim DataArray(1 To 300) As MyUDT

DataArray(1).MyLong = 33000
DataArray(1).MyString = "Bob"
DataArray(1).MyInteger = 17
DataArray(1).MyVariant = Array(1, 2, 3)

End Sub



--
__________________________________
HTH

Bob

"Mike H." wrote in message
...
If I wish to dimension this array: DataArray(300,4) and I know this:
1st element of second dimension will be long
2nd element of second dimension will be string
3rd element of second dimension will be integer
4th element of second dimension will be variant (maybe string, maybe long,
etc).
All elements of first dimension would be variant

The way I currently dim this is:
Dim DataArray(300,4) as variant
Can I precisely dimension this array? How? Thanks.