+ Reply to Thread
Results 1 to 6 of 6

Macro to filter Pivot Table by range

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Macro to filter Pivot Table by range

    I have a report that I am trying to automate. It needs to create a pivot table, filter it, and generate a chart. The way I have it recorded, it is filtering by de-selecting certain usernames (which won't always be there). What I would rather it do is filter by selecting usernames according to a range on a separate worksheet. After searching through the forums, I have hacked together the code below:

    Please Login or Register  to view this content.
    However,
    1) I am not sure that it is written correctly.
    2) I don't believe I am inserting it correctly.

    Sample workbook with filtering by de-selecting certain usernames is attached.
    Attached Files Attached Files
    Last edited by dharmaskibum; 05-21-2012 at 11:37 AM.

  2. #2
    Registered User
    Join Date
    10-20-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to filter Pivot Table by range

    Any suggestions? Any more information that I should provide or clarify?

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to filter Pivot Table by range

    Could really use some help on this. If you have any ideas at all, please let me know, and I will try them.

  4. #4
    Registered User
    Join Date
    10-20-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to filter Pivot Table by range

    I have cross-posted this question here: http://www.ozgrid.com/forum/showthre...176#post610176

  5. #5
    Registered User
    Join Date
    10-20-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to filter Pivot Table by range

    One more time before the holiday weekend...

  6. #6
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Macro to filter Pivot Table by range

    I did this a while ago, never got round to posting.

    For testing, first manually recreate the Pivot Table and Chart on a sheet called New Report then run the macro.

    It filters the Pivot Table Username field from the list in the Counters sheet starting at A1.

    IIRC in your original workbook the Usernames in Data sheet had a trailing space, consequently the Pivot Table Username field also contained a trailing space. I removed all trailing spaces before writing the macro.


    Please Login or Register  to view this content.
    Last edited by T-J; 06-27-2012 at 01:47 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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