Solved

Clearing Autofilter with Macro

Posted on 2014-12-15
2
59 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel 2016 crashes with "Closer" add-in 3 163
Excel - Weightage 3 133
Calculate waiting times that spans two days 10 53
Excel Index/Match issue 4 18
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 the different options available in the Backstage view in Excel 2013.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.

751 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