Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Relate a Number with an ARRAY

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Relate a Number with an ARRAY

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?


Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick

  #3   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Relate a Number with an ARRAY

OK heres an example:

I have Basket # 1908765
In Basket # 1908765, there are 10 items.

I store the 10 items in an array.
I want it so that when the Basket # 1908765 is called, the array is returned.

Hope that clears it up abit.




"Rick Rothstein (MVP - VB)" wrote:

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?


Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Relate a Number with an ARRAY

You can use a collection something like this...

Sub Test()
Dim aryA(1 To 2) As Integer
Dim ary() As Integer
Dim col As Collection

Set col = New Collection

aryA(1) = 123
aryA(2) = 234

col.Add aryA, "12345"

aryA(1) = 987
aryA(2) = 654

col.Add aryA, "98765"

ary = col.Item("12345")
MsgBox ary(1)
ary = col.Item("98765")
MsgBox ary(1)
End Sub
--
HTH...

Jim Thomlinson


"J@Y" wrote:

OK heres an example:

I have Basket # 1908765
In Basket # 1908765, there are 10 items.

I store the 10 items in an array.
I want it so that when the Basket # 1908765 is called, the array is returned.

Hope that clears it up abit.




"Rick Rothstein (MVP - VB)" wrote:

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?


Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick


  #5   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Relate a Number with an ARRAY

So I assume Collection allows arrays to be stored in the "items" whereas
Dictionary doesnt?

"Jim Thomlinson" wrote:

You can use a collection something like this...

Sub Test()
Dim aryA(1 To 2) As Integer
Dim ary() As Integer
Dim col As Collection

Set col = New Collection

aryA(1) = 123
aryA(2) = 234

col.Add aryA, "12345"

aryA(1) = 987
aryA(2) = 654

col.Add aryA, "98765"

ary = col.Item("12345")
MsgBox ary(1)
ary = col.Item("98765")
MsgBox ary(1)
End Sub
--
HTH...

Jim Thomlinson


"J@Y" wrote:

OK heres an example:

I have Basket # 1908765
In Basket # 1908765, there are 10 items.

I store the 10 items in an array.
I want it so that when the Basket # 1908765 is called, the array is returned.

Hope that clears it up abit.




"Rick Rothstein (MVP - VB)" wrote:

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?

Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Relate a Number with an ARRAY

Why not try both and check? If nothing else you'll learn some more
about each of the data structures.

In article ,
says...
So I assume Collection allows arrays to be stored in the "items" whereas
Dictionary doesnt?

{snip}
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Relate a Number with an ARRAY

Yup... That's pretty much it.
--
HTH...

Jim Thomlinson


"J@Y" wrote:

So I assume Collection allows arrays to be stored in the "items" whereas
Dictionary doesnt?

"Jim Thomlinson" wrote:

You can use a collection something like this...

Sub Test()
Dim aryA(1 To 2) As Integer
Dim ary() As Integer
Dim col As Collection

Set col = New Collection

aryA(1) = 123
aryA(2) = 234

col.Add aryA, "12345"

aryA(1) = 987
aryA(2) = 654

col.Add aryA, "98765"

ary = col.Item("12345")
MsgBox ary(1)
ary = col.Item("98765")
MsgBox ary(1)
End Sub
--
HTH...

Jim Thomlinson


"J@Y" wrote:

OK heres an example:

I have Basket # 1908765
In Basket # 1908765, there are 10 items.

I store the 10 items in an array.
I want it so that when the Basket # 1908765 is called, the array is returned.

Hope that clears it up abit.




"Rick Rothstein (MVP - VB)" wrote:

I would like to have some kind of relationship established between numbers
and Arrays. For example, if I call number 1234, I want it to return an
ArrayA(1 to 10) . Library Variables won't work because I can't have Arrays
stored in the Items slot. What can I do?

Can you explain what you want to do in more detail? ArrayA(1 to 10) is
something you would find in a Dim or ReDim statement, so I am not completely
sure what you are after.

Rick


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how does vba relate to vb.net? [email protected] Excel Programming 1 August 23rd 06 04:23 AM
ADO; RELATE vs JOIN. DaveO Excel Programming 2 July 13th 06 01:09 PM
List all contracts that relate to a single part number Ashley Morris Excel Discussion (Misc queries) 2 May 16th 06 04:21 AM
Relate from one worksheet to another Excel Worksheet Functions 2 January 9th 05 01:00 PM
How can I relate three or more lists to one another? Matt Excel Worksheet Functions 2 November 22nd 04 10:27 PM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"