PC Review


Reply
Thread Tools Rate Thread

Can you store a value in different levels of a multi array?

 
 
Gerardo
Guest
Posts: n/a
 
      11th Jun 2008
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.
 
Reply With Quote
 
 
 
 
merjet
Guest
Posts: n/a
 
      11th Jun 2008
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

 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      11th Jun 2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Last entry for Col in Multi column array using cell from another array. bob Microsoft Excel Worksheet Functions 1 15th Nov 2010 09:18 PM
Multi-Levels 2007 =?Utf-8?B?T3R5b2t3YQ==?= Microsoft Word Document Management 6 6th Dec 2007 04:26 PM
match in multi-column and multi-row array sloth Microsoft Excel Misc 14 1st Sep 2006 10:33 PM
Programmatically adding multi-levels of menu to a Windows Form? w.c. Microsoft Dot NET Framework Forms 1 30th Jul 2005 05:06 AM
Unable to store Multi-demensional array in Viewstate Robert P. Microsoft ASP .NET 4 4th Nov 2004 03:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:33 AM.