vba - Macro to copy/paste if autofilter results exist -
vba - Macro to copy/paste if autofilter results exist -
i have next code. applying filter different criteria , works when filter has rows, when doesn't error "property allow procedure not defined , property procedure did not homecoming object" @ line "my_range.parent.autofilter.range.copy".
how can skip empty "paste" go on macro? thanks!!
my_range.autofilter field:=14, criteria1:="=federal" my_range.autofilter field:=7, criteria1:="=no" 'copy/paste visible info new worksheet my_range.parent.autofilter.range.copy sheets("federal").range("c5") .pastespecial xlpastevalues .pastespecial xlpasteformats application.cutcopymode = false '.select end end if
easy way skip trough error write:
on error goto myerrorhandler 'put line on origin of sub/function ... code ... myerrorhandler: 'after error code continues execute line .... more of code...
or write
on error resume next 'your code resume next line of code after error
vba excel-vba
Comments
Post a Comment