Solved

Clearing Autofilter with Macro

Posted on 2014-12-15
2
49 Views
Last Modified: 2014-12-19
I have a large workbook and need to make sure all the worksheets do not have an active autofilter. What is the proper code to check each worksheet and if the autofilter is on remove it  then go to the next worksheet within the workbook and so on?
0
Comment
Question by:bearblack
2 Comments
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
ID: 40502026
HI,

pls try

Sub Macro()
For Each sh In ActiveWorkbook.Worksheets
    On Error Resume Next
    Set fltr = sh.AutoFilter
    On Error GoTo 0
    If Not fltr Is Nothing Then
        sh.AutoFilterMode = False
    End If
Next
End Sub

Open in new window

Regards
0
 
LVL 2

Accepted Solution

by:
Pratik Makwana earned 300 total points
ID: 40502046
try this.. it will remove filter from all sheets..

Sub ShowAllRecords()
        For Each oSheet In ActiveWorkbook.Sheets
        oSheet.Select
          If ActiveSheet.AutoFilterMode Then _
            ActiveSheet.AutoFilterMode = False
        Next oSheet
End Sub
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Viewers will learn how to customize the ribbon and quick access toolbar in Excel 2013.
Video by: Zack
Viewers will learn about using Excel in a browser with Excel Online.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now