excel - unique values in combobox based on another combo box -
i adding unique values in combobox2 based on selection in combobox3. when implementing same code add unique values in combobox3 based on selection on combobox2, not working. replaced combobox2.value combobox3.value , column b column c.
private sub combobox1_change() dim ws worksheet, _ dic object, _ rcell range, _ key string set ws = worksheets("sheet1") set dic = createobject("scripting.dictionary") me.combobox2.clear 'clear added elements me.combobox2.value = vbnullstring 'set active value empty string '------here need tests------- each rcell in ws.range("b2", ws.cells(rows.count, "b").end(xlup)) if rcell.offset(0, -1) <> me.combobox1.value else if not dic.exists(lcase(rcell.value)) dic.add lcase(rcell.value), nothing end if end if next rcell each key in dic userform1.combobox2.additem key next end sub
Comments
Post a Comment