ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with code (https://www.excelbanter.com/excel-programming/377110-problem-code.html)

jln via OfficeKB.com

Problem with code
 
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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1


Don Guillett

Problem with code
 
As always, post your code for comments

--
Don Guillett
SalesAid Software

"jln via OfficeKB.com" <u25956@uwe wrote in message
news:6907a7ec84d2c@uwe...
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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1




Dave Peterson

Problem with code
 
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

"jln via OfficeKB.com" wrote:

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.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1


--

Dave Peterson


All times are GMT +1. The time now is 03:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com