Declare Variables in Array
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. |
Declare Variables in Array
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 Dim tmp As MyUDT tmp.MyLong = 33000 tmp.MyString = "Bob" tmp.MyInteger = 17 tmp.MyVariant = Array(1, 2, 3) DataArray(1) = tmp 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. |
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. |
All times are GMT +1. The time now is 12:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com