excel - Collection function fails to gather unique items when the item is a Number? -


im using following collection script working against each column. have used same script 4 columns, , works perfectly. however, 1 column filled number values , fails return anything. if insert text value in reference field, returned desired. thing can think need number values need interpreted string first, run through collection?

here's code:

sub list_gen_uni()  sheets("xx").select   'units/item  dim uni new collection   on error resume next     each cell in range("j2:j1000")      uni.add cell.value, cell.value      next cell  on error goto 0  = 1 uni.count  cells(i + 1, "k") = uni.item(i)  next   call list_gen_items   end sub  

you correct keys need text, use cstr:

uni.add cell.value, cstr(cell.value) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -