+ Reply to Thread
Results 1 to 3 of 3

Changing Column Orientation in a Pivot Table

Hybrid View

  1. #1
    Registered User
    Join Date
    06-30-2011
    Location
    Stuttgart, Germany
    MS-Off Ver
    Excel 2010
    Posts
    26

    Changing Column Orientation in a Pivot Table

    Hello,

    Whenever I add a new field to a pivot table, it is placed in the rightmost column. I would like my macro to make it be the leftmost column. Whenever my macro comes across this code " .Orientation = xlColumnField", Excel freezes and the only way to close Excel is by using the Task Manager. Following is my code:


    If Range("B3").Value = "Gross Sales" Then
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Net Sales").Orientation = xlHidden
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
    "PivotTable1").PivotFields("Gross Sales "), "Anzahl von Gross Sales ", xlCount
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Anzahl von Gross Sales " _
    )
    .Caption = "Gross Sales"
    .Function = xlSum
    .NumberFormat = "#.##0"
    .Orientation = xlColumnField
    .Position = 2

    End With


    Maybe my code is not even correct to change the column orientation.

    Any help would be greatly appreciated!

    ~az!
    Last edited by az!; 03-04-2013 at 07:30 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Changing Column Orientation in a Pivot Table

    you can't-sensibly anyway-put a data field in the column area so I guess you meant xldatafield
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    06-30-2011
    Location
    Stuttgart, Germany
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Changing Column Orientation in a Pivot Table

    Thank you, I didn't notice that. Now it works!

    ~az!

+ 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