+ Reply to Thread
Results 1 to 3 of 3

Best way to gather/sort/filter from multiple sheets

  1. #1
    Forum Contributor
    Join Date
    10-13-2015
    Location
    Culloden, West Virginia
    MS-Off Ver
    2010
    Posts
    168

    Best way to gather/sort/filter from multiple sheets

    Hello all,

    I'm trying to come up with the best way to filter and sort data that is on multiple sheets.

    The data I have comes from 3 different sources that I copy and paste into one workbook. The columns are always the same but the amount of rows will vary.

    I'm looking for the best way to simplify the data for each Organization that I send it to.

    I've made a macro for each Org that filters and sorts each set of data for that Org, but as the data changes the macro doesn't and if one Org doesn't have any data in one of the lists for a given month, it gives an error.

    I've made a pivot table and had a macro sort the data for each org, but if one Org doesn't have any data in one of the lists for a given month, it gives an error.

    To summarize, I'm trying to create a Button that each Org can click and see their data (organized) from the 3 sheets in the workbook.

    The problems I've encountered...
    1. The data changes in the amount of rows from month to month.
    2. If there is no data for one of the Organizations in a given month, the macro throws an error.

    I've attached a simple version of my workbook.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-13-2015
    Location
    Culloden, West Virginia
    MS-Off Ver
    2010
    Posts
    168

    Re: Best way to gather/sort/filter from multiple sheets

    I've figured out the dynamic data piece.

    I just need help with the VBA portion now. When I run my macro and it filters the data, everything works fine unless there is no data for one of the organizations.

    With no data, the organization will not be in the list to pick from.

    This is the code i have...

    Please Login or Register  to view this content.
    In this example, as long as Epcot is in my list, I'm good. However, if there's a month where Epcot didn't have a data point, Epcot won't be in the list. This is causing the macro to error.

    I'd like for it to select (blank) if Epcot is not available.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Best way to gather/sort/filter from multiple sheets

    Hi jme1013,

    As you have discovered attempting to Assign a 'Filter Name' that DOES NOT EXIST can corrupt the 'Filter Cache'.

    I accidentally discovered that the 'PivotFilter Cache' can be repaired if the 'Missing Filter Name' is known.
    Please Login or Register  to view this content.
    If there is only one Pivot Table on a sheet it can be accessed as:
    ActiveSheet.PivotTables(1) instead of ActiveSheet.PivotTables("PivotTable13")

    The solution is to do some defensive programming to prevent 'Pivot Cache Corruption' from occurring. See the following code excerpts (non-working - needs additional resources). Working code with the identical code is in the attached file which uses a 'Pivot Table' derived from your sample 'Travel' Worksheet.
    Please Login or Register  to view this content.
    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gather data multiple sheets into 1 workbook
    By Nnex1996 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2019, 03:37 AM
  2. Replies: 0
    Last Post: 08-04-2017, 02:39 AM
  3. Is there a way to gather, sort, or collect from two columns?
    By 20GT in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-02-2017, 11:54 AM
  4. Gather data from multiple sheets
    By nchinas in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-09-2015, 03:57 PM
  5. How to sort rows in Excel into different sheets using a filter
    By lukeafuller in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2014, 04:29 AM
  6. Using for loop to gather multiple values from different sheets
    By alexwgordon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2011, 08:08 PM
  7. Replies: 0
    Last Post: 07-27-2011, 01:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1