Problem with code

  • Thread starter Thread starter jln via OfficeKB.com
  • Start date Start date
J

jln via OfficeKB.com

OK i have a macro that does an auto filter and counts takes the results and
pastes the rows that i have set over to another page. The probelm is that
when the auto filter come back with ne results it pastes everthing. What can
i do to stop this?

I have tried counting before the filter and after and comparing the totals
and do if = then exit sub with no luck.
I have tried a msgbox with a yes no and that didnt work.
 
You can count how many visible cells are shown in column 1 of the autofilter
range. The headers will always be visible, so check for more than 1.

with activesheet.autofilter.range
if .columns(1).cells.specialcells(xlcelltypevisible).cells.count = 1 then
'only headers are visible
'do nothing???
else
'do what you want
end if
end with
 

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

Back
Top