Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove filter prior to running code

Posted on 2013-10-31
2
Medium Priority
?
196 Views
Last Modified: 2013-10-31
I have a series of macros and code that manipulates data.  Problem i have today is that if a user processes the data once, takes a look at what they did/happened filters the data, and then runs the code again it bombs. - Code wont run right if the data is filtered (multiple tables and pivots)

For the pivot tables i have no problems.  I have some code that goes to the offending pivot table prior to the execution of the code and runs clears the filter(s)

for tables i have an issue.  Prior to execution I run some code that goes to the worksheet that the table is on and clear the filters using:

ActiveSheet.ShowAllData

Works fine as long as the data is filtered, if the data has not been filtered it throws an error...

I need to either be able to tell/determine if the data on a particular worksheet has been filtered and then run:

If data is filtered then
   ActiveSheet.ShowAllData

Or use a different method of unfiltering the data.

Thanks...
0
Comment
Question by:deskchains
[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
2 Comments
 

Accepted Solution

by:
deskchains earned 0 total points
ID: 39615026
Never Mind....

Found a solution:


Sheets("BAF Data").Select
    If ActiveSheet.FilterMode Then
    ActiveSheet.ShowAllData
  End If
0
 

Author Closing Comment

by:deskchains
ID: 39615029
Figured it out...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

721 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