Solved

Clearing Autofilter with Macro

Posted on 2014-12-15
2
57 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 50

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
best spreadsheet for iPhone 6s? 1 215
MS Excel shared file syncing 8 75
Turn date into age 17 32
split user ID and domain name from email addresses using formula 3 15
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
Viewers will learn how to share Excel data with others from desktop Excel, as well as Excel Online via OneDrive, and embed an Excel file on a website.
Video by: Zack
Viewers will learn the basics of using Excel Tables, the benefits found with them, and some pitfalls.

792 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