+ Reply to Thread
Results 1 to 2 of 2

Unable To Get The Pivotfields Property Of The Pivot Table when modify field filter

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    Unable To Get The Pivotfields Property Of The Pivot Table when modify field filter

    Hi

    I'm trying to modify a filter on a pivot table field, and can't figure out what the issue is.

    I did this manually, tracking it with the macro recorder, and got this code:

    Sub Macro4()
    ' Macro4 Macro
    ActiveSheet.PivotTables("pvtByClip").PivotFields("GroupDescription").ClearAllFilters
    ActiveSheet.PivotTables("pvtByClip").PivotFields("GroupDescription").PivotFilters.Add _
    Type:=xlValueIsGreaterThan, _
    DataField:=ActiveSheet.PivotTables("pvtByClip").PivotFields("This Month"), _
    Value1:=500000, _
    Order:=0
    End Sub

    Without any mods to the code (apart from tidying up the line breaks) when I try to re-run this code - with the relevant sheet activated - I get the error happening (at the ClearAllFilters firstly).

    What I'm trying to do is pass a value parameter to the code to modify the filter clip level via VBA.

    I'd appreciate any pointers on how to resolve this - thanks.

  2. #2
    Registered User
    Join Date
    08-17-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Unable To Get The Pivotfields Property Of The Pivot Table when modify field filter

    I just solved it - the Macro Recorder was using the original pivot field name, whereas I had set a different description for the 'GroupDescription' field.

    Macro recorder ignored the new description in creating its code, but VBA seems to need the actual description!

    Another undocumented feature of Excel I guess

+ 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. Unable to get the PivotFields property of the PivotTable Class
    By ajmarti82 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 04:40 PM
  2. Unable to get the pivotfields property of the pivot table class
    By hardhat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2013, 11:41 AM
  3. Unable to get the PivotFields property error
    By Anthem12 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2013, 08:14 PM
  4. run-time error 1004 unable to get the pivotfields property of the pivot table class
    By arunsoni in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2011, 02:06 PM
  5. [SOLVED] Unable to get the PivotFields property of the PivotTable Class
    By Karl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2006, 02:20 PM

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