Hash and Stack in VBA
These are a couple of links that I want to keep handy. They describe creating a stack and a hash table in VBA.
Hash and Stack in VBA for centralised configuration and error handling
Daily posts of Excel tips…and other stuff
These are a couple of links that I want to keep handy. They describe creating a stack and a hash table in VBA.
Hash and Stack in VBA for centralised configuration and error handling
Certain comments are subject to moderation and may not appear immediately. You can use HTML tags in your comment. If you include a greater-than or less-than sign or anything else that could be interpreted as HTML, your comment won't look nice. You need to escape those characters. To post VBA code in your comment, use [VB] tags, like this: [VB]Code goes here[/VB].
fzz:
Maybe there are arguments in favor of stacks as a data type, but there’s no clear point I can see to a limited hash table type vs either generic VBA Collection objects or WSH Dictionary objects. Not the point of late/lazy population of such a table, just the pointlessness of reinventing the data structure.
11 January 2008, 1:42 pmColin Banfield:
11 January 2008, 5:53 pm
Colin Banfield:
fzz wrote:
Maybe there are arguments in favor of stacks as a data type, but there’s no clear point I can see to a limited hash table type vs either generic VBA Collection objects or WSH Dictionary objects. Not the point of late/lazy population of such a table, just the pointlessness of reinventing the data structure.
Looking at the code in the links, it does appear to be a reinvention of the wheel, without the advantages of “modern tires” like the Collection object. Interesting that you mention the Dictionary object. I tend to use it more often than the Collection object. Come to think of it, I can’t recall any discussion of the Dictionary object in VBA circles, in spite of its many advantages over the Collection object.
11 January 2008, 6:41 pmDoug Glancy:
Colin, FYI I’ve seen Dictionary discussed in the VBA ng’s and in a bit on this blog, I think. Chip Pearson goes into using Collections and Dictionary objects in VBA on his site:
http://www.cpearson.com/excel/CollectionsAndDictionaries.htm
11 January 2008, 7:29 pmColin Banfield:
Doug,
Thanks for the heads-up. I completely overlooked Chip’s discussion on this topic.
11 January 2008, 10:07 pmross:
…Excellent name for a blog, BTW.
14 January 2008, 9:07 amAlderaic:
Dictionnary are definitely a good weapon when it comes to VBA,
I built an entire translation tool using dictionnary, and its actually running faster than the same program done in delphi (command line only and optimized). I was able to translate a 75 000 lines text file with each line being between 2000 and 3000 lines in less than 5 sec…
16 January 2008, 11:22 am(open file send each line into an array using split, then replace each cell of the array by the corresponding entry in the dictionnary and write the line back to the new file)
and the dictionnary was about 1200 entries