Brandon,
The first thing the code does is create a Dictionary object. This
is similar to a Collection object but is much faster and has more
features. A Dictionary is a set of paired objects: the object
itself (any variable type) and an associated key (a unique
string). See help for more details about a Dictionary.
Then the code loops through range A1:A20. For each cell in this
range, we call the Exists method of the Dictionary to determine
if a key matching the range text exists. If Exists returns True,
a key with that value already exists in the Dictionary and so we
do nothing. If Exists returns False, no key matching the cell
value exists in the Dictionary, so we add it. In this case, both
the item and the key are the same.
At the end of the loop, we have a Dictionary containing the
unique values from A1:A20. Then, we loop through the Items of the
Dictionary, adding each one to the listbox.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com