excel - VBA Autofilter not filtering by my criteria -


i created filter feature working before, left couple days (over weekend) , doesn't filter correctly.

i have included code below examination. have run watches, , seems getting autofilter line correctly. running out of ideas.

is there may have changed on sheet breaking autofilter? have added in 1 of criteria breaking it?

thanks

note: variables not dimed either globals or junk variables. also, index sortfield may off; working on following that. still seems when filtering in correct column, filters out everything.

private sub filter_commandbutton_click()     'filters text input , column filter     dim isincol boolean     dim sortkey string     dim sortorder xlsortorder     dim currentdata range     dim sortfield integer ' offset, determined list index     dim lastrow integer ' used set working range       if filtercolumn nothing         gojira = msgbox("you need enter column filter", vbokonly)         exit sub     end if      ' set target = activeworkbook.worksheets("testing_filter_form")     lastrow = activesheet.cells(rows.count, "a").end(xlup).row + 1 ' target.cells(rows.count, "a").end(xlup).row + 1      ' put borders around whole row     ' target.range(target.cells(lastrow, 1), target.cells(lastrow, 56)).borders.linestyle = xlcontinuous      ' setting active sheet complete data     set currentdata = activesheet.range(activesheet.cells(1, 1), activesheet.cells(lastrow, 12))      ' make sort key wildcard     if include = true         sortkey = "*" & filtertext & "*"     else ' excluding entered text         sortkey = "<>" & "*" & filtertext & "*"     end if      ' find list index sorting     sortfield = me.columnfilter_combobox.listindex ' + 1      ' populate sort order value of ascend/descend options.     if descend         sortorder = xldescending     else         sortorder = xlascending     end if      ' search column see if text exists     isincol = false     each foo in filtercolumn         if casesense             if instr(foo.value, filtertext) ' > 0                 isincol = true                 exit             end if         elseif not casesense             if instr(lcase(foo.value), lcase(filtertext))                 isincol = true                 exit             end if         end if     next foo      if isincol ' filter table selected col; use range sort         target             currentdata.autofilter field:=sortfield, criteria1:=sortkey, visibledropdown:=false             currentdata.sort key1:=filtercolumn, order1:=sortorder, header:=xlyes         end     end if      blah = bleh end sub 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -