+ Reply to Thread
Results 1 to 2 of 2

Code to add calculated data fields to Pivot Tables

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Code to add calculated data fields to Pivot Tables

    I needed to add a bunch of calculated data fields to pivot tables. It was getting to be a pain in the butt to do it through the GUI after the umpteenth time, so I decided to record a macro and script it.

    It worked the first time around and failed the second time.

    The first time around, I essentially ran this block of code incremented about 20-30 times (just one macro)
    Please Login or Register  to view this content.
    This appeared to work very well. I tried to repeat my previous success, but failed.

    I copied the worksheet that contained the pivot table mentioned above and ran this block of code incremented 20-30 times. This time around, I changed the calculation a bit and changed the number format.

    Please Login or Register  to view this content.
    For some reason it fails at line 4 and returns this error message:
    "unable to get the pivotfields property of the pivottable class"

    Any ideas? Thanks!

  2. #2
    Registered User
    Join Date
    07-23-2008
    Location
    Shanghai
    Posts
    11

    Re: Code to add calculated data fields to Pivot Tables

    Just like it says "nable to get the pivotfields property", please check if there's a "110 Difference" in the column names.

    Also, it helps us a lot to understand your problem if you can post your workbook as well as an attachment.

    Regards,
    YM

+ 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