excel - Converting a formula into vba -
i have sheet evaluation. in sheet, have 3 columns s, t, , u.
if column s contains invalid , if column t , u both filled, need filter complete row.
for this, tried below code. code works fine me. other colleagues, filter not work according condition.
column z considered helper column marks true, or false depending on condition. if both columns t , u filled , s invalid , marks false, , rest true
i have used option explicit above modules.
can suggest, how can overcome ? can 1 me code , without using formula
sub fc() dim totalrows long dim sformula totalrows = range("a5").end(xldown).row sheets("evaluation").range("z5:z" & totalrows) ' if s5 not equal invalid , 1 of column t , u filled, activate autofilter sformula = "=and(s5<>""invalid"",or(isblank(t5),isblank(u5)))" .formula = sformula .autofilter 26, true .value = .value end end sub
i tried out, , according experience there, following should work:
sub fc() dim totalrows long, sformula string sformula = "=and(s5<>""invalid"",or(isblank(t5),isblank(u5)))" totalrows = range("a5").end(xldown).row sheets("evaluation").range("z5:z" & totalrows) .formula = sformula .autofilter 1, true ' take first column of current range end end sub in version used .autofilter 26, true would work, had applied range [a1:z<no of rows>], since working on range [z1:z<no of rows>] have 1 column in range.
i don't know trying achieve .value = .value. far can see, replace current value current value, i. e. nothing useful, or missing something?
Comments
Post a Comment