Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Declare and Set Public variables | Excel Discussion (Misc queries) | |||
how to declare local variables for Excel.Workbook at runtime. | Excel Discussion (Misc queries) | |||
How to efficiently declare variables | Excel Discussion (Misc queries) | |||
How to declare a dynamic array | Excel Discussion (Misc queries) | |||
How to use array formula for three variables? | Excel Discussion (Misc queries) |