Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove filter prior to running code

Posted on 2013-10-31
2
Medium Priority
?
202 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
  • 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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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‚Ķ

916 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