Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Dictionary Object in Excel VBA

Tags:

excel

vba

I am struggling to make my Dictionary object work to return economic details of selected Reference number.

e.g. I have below reference nos and corresponding values, however, not sure if I can achieve this using Dictionary object , and alternative, suggestion would be highly appreciated.

Ref No  Amount Price   Year
IB1232  1000   1.23    2011
IB1231  1000   3.23    2011
IB1233  1000   3.43    2011
IB1234  1000   3.43    2011

I thought would be able to achieve by forming Key and Value for reference and their corresponding details, but not been able to achieve ..

like image 839
Sky Cobb Avatar asked Jul 26 '11 17:07

Sky Cobb


1 Answers

@das_weezul

There is a Dictionary object in VBA in the scripting library (you need to add that reference to use it). The Dictionary has some extra functionality, such as the ability to check if a key exists before trying to access it.

@Sky Cobb

Yes, you could do all of the above tasks with the Dictionary. The syntax will the same, except you should provide a key for every item that you add to it.

like image 189
Adam Clason Avatar answered Nov 25 '22 21:11

Adam Clason