+ Reply to Thread
Results 1 to 2 of 2

Differentiate between column fields and data fields in a pivot table

  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Question Differentiate between column fields and data fields in a pivot table

    Hello,

    I am trying to manage the format for a pivot table that we receive from a customer every week. In order for my macro to function correctly, I need to be able to format the pivot table to the expected format, with the expected pivot row fields and pivot column fields. I've been able to do this for rows fields, and for format using some code for autoformat, etc., but not for data the column fields.

    The data fields change once a month (which is expected and compensated for in my macro), but I need to be able to remove any column fields without removing any data fields using VBA.

    Therefore, I have tried the following code to remove column fields:
    Please Login or Register  to view this content.
    However, this also for some reason deletes my fields in pivotdata as well.

    To compensate, I tried the following code:

    Please Login or Register  to view this content.
    However, now it will not remove any column fields, thinking that they are data fields.

    Is there any way in VBA to systematically differentiate between column fields and data fields so I can remove column fields while leaving data fields as is?

    Thanks.

    Regards,

    William

  2. #2
    Registered User
    Join Date
    08-12-2009
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Differentiate between column fields and data fields in a pivot table

    Hi All,

    I found my answer. Apparantly (at least in Excel 2003 and I'm assuming the same in Excel 2007), if more than one pivot field is loaded as data, than rather then having a pivot field in the data fields area, Excel makes a pivot field called Data and places it in the columns area.

    Thus, all I needed in my code was

    Please Login or Register  to view this content.
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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