Wednesday 16 January 2013

VB.NET Excel Pivot - Move sigma values to column

                Dim ptSigmaRow As Excel.PivotField
                For Each ptSigmaRow In ptTable.RowFields
                    Dim d As String = ptSigmaRow.Name
                    If ptSigmaRow.Name = "Data" Then
                        ptSigmaRow.Orientation = XlPivotFieldOrientation.xlColumnField
                    End If
                Next

2 comments:

  1. Thank you very much.

    Please add this code after setting all pivoting field with require value. It works fantastic.

    -M.Shekh

    ReplyDelete
  2. thanks!

    I used this

    _PivotField = (PivotField)_PivotTable.PivotFields("Data");
    _PivotField.Orientation = XlPivotFieldOrientation.xlColumnField;

    ReplyDelete