+ Reply to Thread
Results 1 to 17 of 17

Filter Pivot with call value in named range

  1. #1
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Filter Pivot with call value in named range

    Hi all,
    Can anyone tell me why this code isn't running?

    Stopping at .PivotFilters.Add error: Application-defined or object-defined error

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    is there anything to actually filter?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    Yes, plenty

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    well the syntax looks fine so can only say its the structure or data

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    just one other thing
    the field you are applying to

    its not in report filter is it? because it wont work at that level

  6. #6
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    Its just a pivot table column, not value.
    It does currently have a filter applied in the same column. I did not want to remove the current filter as I only want to show 1 row in the pivot table.
    Is this what is causing it?

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    ok column is no issue

    you cannot apply a filter on the current filter (of the same type..either value or label) using pivotfilter.add

    you can easily test this
    just clear the filter and run the code to see if it gives you the same error

  8. #8
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    That's it!
    Is there a string of code I can apple so that it does NOT overwrite the text below when removing the filter?

  9. #9
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    please rephrase the question

  10. #10
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    *Apply
    haha... apple

    The pivot I am trying to filter is sitting above another table.
    This pivot will only have 1 value at a time in the filtered column (1 row). If I need to clear the filters it either doesn't apply the next segment of code or overwrites the table below.

  11. #11
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    so you really just want to replace existing filter?

    maybe
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    no joy, I'm afraid.

  13. #13
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Filter Pivot with call value in named range

    Perhaps this
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  14. #14
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    Hi xlnitwit,

    the code is still stopping at the .clearallfilters

  15. #15
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    I'm sure you already experienced it but VBA with pivot tables is a real finicky area
    without actual example its really hard to replicate what comes in and out

    if i am understanding your actual situation accurately (this is still in doubt) and no simple way cannot be found

    i would run a loop for pivot items and do it manually
    ie set item manually to visible and set previous visible to false

  16. #16
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Filter Pivot with call value in named range

    Thanks Humdingaling,
    I think you might be right, how would I do that with the above code?

  17. #17
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Filter Pivot with call value in named range

    i cannot code without an actual example to base the code upon

    i dont currently have to time to setup a dummy example
    so please provide one if you want me to fill in the gaps

+ 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. Filter pivot table based on named range - Error 1004
    By Upset in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-11-2015, 05:42 AM
  2. vba to filter on a named range
    By chasoe in forum Excel General
    Replies: 0
    Last Post: 06-24-2015, 03:45 AM
  3. Call Code on Pivot Table Filter Change
    By alexjp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2012, 02:47 PM
  4. Call Cell in a named range
    By caippers in forum Excel General
    Replies: 2
    Last Post: 04-28-2011, 10:39 AM
  5. Change pivot filter based on call value in various sheets
    By dalew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2011, 01:12 AM
  6. User entry when cell uses INDIRECT() to call a named range
    By phalanxiii in forum Excel General
    Replies: 3
    Last Post: 06-08-2009, 06:22 PM
  7. [SOLVED] named range with filter
    By dee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2005, 12:05 PM

Tags for this Thread

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