Stop copying down values

L

Len

Hi,

I'm not sure how to modify an excel macro to stop copying down values
from adjacent column when no data found in auto-filtering.

Say, an excel macro is set to copy down data range from A3 to K50 ( ie
the last used cell ) where the auto-filtering set on header J2 to
filter out value > 0 in J column.
Excel Macro will copy down values from A3 to K column last used cell
for both data found ( is value > 0 ) and no data found ( ie blank
cell ) in filtering column J
How to set excel macro to stop coping down values from A3 to K column
of last used cells, for no data found in column J after filtering the
value > 0

Thanks & Regards
Len
 
J

Joel

Test the column before applying the filter

set c = columns("B").find(what:="abc", lookin:=xlvalues, lookat:=xlwhole)
if not c is nothing then
columns("B").AutoFilter Field:=1, Criteria1:="abc"
end if

end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top