excel - Ending a macro when autofilter has no matches -


i have macro set filter data year, quarter, mobile (yes / no) end goal being creates schedule document show in q1 - q4 each year subset of data.

the issue having once has filtered first 2 variables, if there no matches third (value match ü) negates , copies raw data sheet if no filters applied.

    sheets("changelog").select  activesheet.range("$a$2:$ap$2040").autofilter field:=36, criteria1:="4" activesheet.range("$a$2:$ap$2040").autofilter field:=35, criteria1:="2020" activesheet.range("$a$2:$ap$2040").autofilter field:=15, criteria1:="ü" range("a3:a2041").select selection.copy sheets("!pipeline_template").select range("n77").select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _     :=false, transpose:=false 

it continues various filter criteria follow same pattern. ideally want end sub if can't find "ü"

any appreciated :)

mark

thanks simon,

we managed figure out using if after autofilters.

    vrows = sheets(shtchangelog).cells(rows.count, 1).end(xlup).row     if vrows > 2 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -