Can you store a value in different levels of a multi array?
I'm working with arrays, and I thought that I could store the names for
(let's say) rows in level one of the array, and then have stored values in the second level. But it seems that the only place to store values is the last level of the array. Does that means that I have to keep a second array with the names for first level elements? Moreover, if I need "redim preserve" it looks that I can't add a second dimension to one dimensional array. |
Can you store a value in different levels of a multi array?
Consider a user-defined data type. An example follows.
'declarations Type Customer Name as String Purchase() As Single End Type Sub Main() Dim tCust(1 to 2) As Customer tCust(1).Name = "Bill" ReDim tCust(1).Purchases(1 to 2) tCust(1).Purchase(1) = 20.25 tCust(1).Purchase(2) = 29.00 End Sub Hth, Merjet |
Can you store a value in different levels of a multi array?
Gerardo wrote:
I'm working with arrays, and I thought that I could store the names for (let's say) rows in level one of the array, and then have stored values in the second level. But it seems that the only place to store values is the last level of the array. Does that means that I have to keep a second array with the names for first level elements? Not clear what you mean by "the only place to store values is the last level of the array"? Moreover, if I need "redim preserve" it looks that I can't add a second dimension to one dimensional array. If the functions in the freely downloadable file at http://home.pacbell.net/beban are available to your workbook arr = TwoD(arr) Alan Beban |
All times are GMT +1. The time now is 02:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com