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
Post a Comment