+ Reply to Thread
Results 1 to 2 of 2

Empty Pivot Field using a Macro

  1. #1
    Jasper
    Guest

    Empty Pivot Field using a Macro

    although I tried a couple of options, I do not seem to sucseed in making a
    macro which actualy empties the PivotField as I want to.

    I tried:
    ActiveSheet.PivotTables("PivotTable3").PivotFields("Count of Uren"). _
    Orientation = xlHidden

    But as the pivot Field is not always "Count of Uren", the macro Bug's as
    soon as the PivotField is filled with something else.

    Who knows how I can make this work? Thanks in Advance!

  2. #2
    Debra Dalgleish
    Guest

    Re: Empty Pivot Field using a Macro

    To clear all the pivot table's data fields:

    '=========================
    Sub RemoveDataFields()
    Dim pt As PivotTable
    Dim pf As PivotField
    Set pt = ActiveSheet.PivotTables(1)

    For Each pf In pt.DataFields
    pf.Orientation = xlHidden
    Next pf

    End Sub
    '==========================

    Jasper wrote:
    > although I tried a couple of options, I do not seem to sucseed in making a
    > macro which actualy empties the PivotField as I want to.
    >
    > I tried:
    > ActiveSheet.PivotTables("PivotTable3").PivotFields("Count of Uren"). _
    > Orientation = xlHidden
    >
    > But as the pivot Field is not always "Count of Uren", the macro Bug's as
    > soon as the PivotField is filled with something else.
    >
    > Who knows how I can make this work? Thanks in Advance!



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


+ 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