i've looked quite @ few examples online. find in combo box drop down. boss wants type in excel, example in a1 123456 , must auto filter data list starting 123456. selects option wants , move on cell a2.
all examples i've tried combo box, not needs. can please point me in right direction? appreciated.
building off of answer this similar question, came should work. had similar request recently; think it's nice feel opposed usual ui filters.
my setup looks this:
as @petert mentions, need use worksheet_change event specific sheet, looks this:
private sub worksheet_change(byval target range) dim filterfield filterfield = 0 if target.address = "$b$2" filterfield = 1 elseif target.address = "$c$2" filterfield = 2 elseif target.address = "$d$2" filterfield = 3 elseif target.address = "$e$2" filterfield = 4 end if if filterfield <> 0 call updatefilter(filterfield, target.value) end if end sub
there's lot of cleaning , simplifying can done in code, version quick , dirty specific example - should not hard generalize, if need help, leave comment.
you need more vba update filters:
public sub updatefilter(filterfield, strvalue) if strvalue = "" range("b4").autofilter field:=filterfield, criteria1:="<>" else strvalue = strvalue & "*" range("b4").autofilter field:=filterfield, criteria1:=strvalue end if end sub
end result looks this:
adding '*' end of string allows partial matches ("begins with..."):
Comments
Post a Comment