View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edward Ulle Edward Ulle is offline
external usenet poster
 
Posts: 92
Default Lookup in an array

The Type you describe; key and value, looks very much like a Collection.
The beauty of collection is they are dynamic.

The following is a simple example.

Option Explicit

Sub Test()

Dim myCollection As Collection

Set myCollection = New Collection

myCollection.Add Item:=1#, Key:="one"
myCollection.Add Item:=2#, Key:="two"
myCollection.Add Item:=3#, Key:="three"

MsgBox myCollection("two")

Set myCollection = Nothing ' Remove from memory

End Sub



*** Sent via Developersdex http://www.developersdex.com ***