Results 1 to 2 of 2

Removing a pivot field in the Value Field - Macro - Pivot Charts

Threaded View

  1. #1
    Registered User
    Join Date
    04-28-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2003
    Posts
    24

    Question Removing a pivot field in the Value Field - Macro - Pivot Charts

    Hi There

    Building on from this here – how do I remove the PivotField("#") from the Values field

    The below macro basically goes through the 2 pivot charts and puts the pivot field “#” in the Values field in position 1

    Now how do I reverse this and remove it

    Sub Macro8_how_to_target_Line_test_T_J()
    '
    ' Macro8 Macro
    '
    
    '
    
    Dim ws As Worksheet
    Dim objPT As PivotTable
    Dim objPTField As PivotField
    
    For Each ws In Worksheets
    ws.Visible = xlSheetVisible
        
        For Each objPT In ws.PivotTables
            MsgBox "Pivot table name: " & objPT.Name & vbCrLf & "Sheet name: " & ws.Name & vbCrLf & "test"
          '  With objPT.PivotFields("#3")  ', "Sum of #3", xlSum
                With objPT.PivotFields("#")
                .Orientation = xlDataField
                .Function = xlSum
                .Position = 1
                End With
                    
        Next objPT
           
    Next ws
    
    End Sub

    I have tried adding something like the below to remove it but I cannot work it out. Appreciate any help.



    Sub Macro11()
    '
    ' Macro11 Macro
    '
    
    '
        ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of #").Orientation = _
            xlHidden
    End Sub
    Attached Files Attached Files

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