Hi Clay,
Is there any reason you cannot to use a pair of 1D arrays for your Longs and
Strings and a 2D array for your dates. However 200x4 array is not large and
I doubt you'd notice any performance loss by declaring as a Variant.
If you particularly want to fix mixed data types within the array, eg for
coercing to correct data type, you could do -
Dim v(1 To 4)
Dim arrL(1 To 200) As Long
Dim arrS(1 To 200) As String
Dim arrD1(1 To 200) As Date, arrD2(1 To 200) As Date
'arrL(1) = 123
'arrS(1) = "abc"
'arrD1(1) = Date
'arrD2(1) = Date + 1
v(1) = arrL
v(2) = arrS
v(3) = arrD1
v(4) = arrD2
v(1)(2) = 6.789
MsgBox v(1)(2) ' 7 rounded to a long
v(3)(2) = CLng(Date) ' a number
MsgBox v(3)(2) ' a date
v(1)(3) = "abc" ' error type mismatch, expecting a long
Regards,
Peter T
"Clayman" wrote in message
...
I would like to declare a multi-dimensional array with different types,
such
as:
dim array(200,4) where (x,1)=Long, (x,2)=String, (x,3)=Date, (x,4)=Date
Can this be done or should I leave it as Variant? After reading Mr.
Pearson's page (http://www.cpearson.com/excel/variables.htm) regarding
variables I'm hesitant to leave it...
--
Adios,
Clay Harryman