excel - Search for complete data in column "k" -
i created report userform
using advance filter , search works fine. want show complete data , uncompleted data check box.
this search code:
private sub commandbutton1_click() 'dim variables dim crit range dim findme range dim datash worksheet 'error handler on error goto errhandler: 'set object variables set datash = sheet1 'hold in memory , stop screen flicker application.screenupdating = false '/////////////////////////////////////////// 'if header selected add criteria if me.cmdheader.value <> "all_columns" if me.textbox1 = "" datash.range("bu9") = "" else datash.range("bu9") = "" & me.textbox1.value & "" end if end if '////////////////////////////////////////// 'if columns selected if me.cmdheader.value = "all_columns" 'find value in column set findme = datash.range("b9:bk30000").find(what:=me.textbox1, lookin:=xlvalues, _ lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false) 'variable criteria header set crit = datash.cells(8, findme.column) 'if no criteria added search if me.textbox1 = "" datash.range("bu9") = "" datash.range("bu8") = "" else 'add values search datash.range("bu8") = crit if crit = "id" datash.range("bu9") = me.textbox1.value else datash.range("bu9") = "" & me.textbox1.value & "" end if 'show in userform header added me.textbox2 = datash.range("bu8").value end if end if '///////////////////////////////////////// 'unprotect sheets 'unprotect_all' 'filter data datash.range("b8").currentregion.advancedfilter action:=xlfiltercopy, _ criteriarange:=range("data!$bu$8:$bu$9"), copytorange:=range("data!$bw$8:$ef$8"), _ unique:=false 'add dynamic data listbox lstdata.rowsource = datash.range("outdata").address(external:=true) end sub
Comments
Post a Comment