ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   remove autofilter results with a macro (https://www.excelbanter.com/excel-programming/431282-re-remove-autofilter-results-macro.html)

Don Guillett

remove autofilter results with a macro
 
Here's one I did recently

Sub Togglefilteroutzero()
If ActiveSheet.AutoFilter Is Nothing Then
Range("b1").AutoFilter Field:=2, Criteria1:="<0"
Else
Range("b1").AutoFilter
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message news:...
As ALWAYS, post your code for comments

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Muth69" wrote in message
...
I can't seem to find anything similar to this. I'm trying to setup a
macro
that will unfilter the sheet if the autofilter has been engaged. I can
get
it to work as long as at least 1 column has been autofiltered, but if
none
has been I get a run time error 1004. So then I tired a If then, but it
keeps hanging on part of the field. Thanks for your help.





All times are GMT +1. The time now is 09:02 AM.

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