+ Reply to Thread
Results 1 to 7 of 7

Macro to filter Pivot not working

  1. #1
    Registered User
    Join Date
    06-01-2011
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro to filter Pivot not working

    Hi,

    I've created a simple macro to change the filters of one of the pivot charts. However, when i run the macro, i get the following error; "Run-time error 1004. Unable to get the Pivot Tables property of the Worksheet Class"

    Here's the code:
    Please Login or Register  to view this content.
    Ideally, i would extend the macro to change the same field ("University") on all four pivot charts on the sheet, but i'm trying to get it to work with one first.

    Thanks in advance.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Macro to filter Pivot not working

    Can you post a sample workbook that exhibits the problem?

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-01-2011
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to filter Pivot not working

    Attached is a sample file with some of the more confidential data removed.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-01-2011
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to filter Pivot not working

    Hi guys,

    Han anybody managed to solve this issue?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Macro to filter Pivot not working

    Does this do what you want?


    Please Login or Register  to view this content.


    Regards

  6. #6
    Registered User
    Join Date
    06-01-2011
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to filter Pivot not working

    Thanks for the help!

    This works fine when i'm in the sheet called "Chart", but I get an error message when i run the macro while being in any other sheet.

    Error: "The item with the specified name wasn't found."

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Macro to filter Pivot not working

    Comment out or remove this line:

    Please Login or Register  to view this content.

    Regards

+ 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