excel - Seach Column based on textbox value and display all results in Listbox -
i have
listbox = firmlist; textbox = firmgroupid; worksheet = relatedfirms; columna = gid (id numbers); columnb = firmname
i trying populate list box based on value of firmgroupid.
have combobox populates gid number in firmgroupid depending on combobox selection.
i firmlist populate list of firmnames based on firmgroupid.
sheet relatedfirms contains assigned gid each firmname.
this seems simple try doesn't seem work.
not sure how show items in list box have value equals gid.
private sub firmgroupid_change() dim rngname range dim ws worksheet dim integer set ws = worksheets("relatedfirms") = 1 ws.cells(ws.rows.count, 1).end(xlup).row step 1 if ws.cells(i, 1).value <> vbnullstring me.firmlist.additem ws.cells(i, 1).value next end sub
please change code:
if ws.cells(i, 1).value <> vbnullstring me.firmlist.additem ws.cells(i, 1).value
to
if ws.cells(i, 1).value = firmgroupid.value me.firmlist.additem ws.cells(i, 2).value
Comments
Post a Comment