1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
' Exchange rows and columns of selected Pivot Table
' Source: Universitдts-Rechenzentrum Trier
' http://www.uni-trier.de/urt/user/baltes/docs/saxbasic/saxbasic.htm

Option Explicit

Sub Main
	Dim objPivotTable As PivotTable
	Dim objItem As ISpssItem
	Dim bolFoundOutputDoc As Boolean,bolPivotSelected As Boolean

	Call GetFirstSelectedPivot(objPivotTable,objItem,bolFoundOutputDoc,bolPivotSelected)
	If (bolFoundOutputDoc=False) Or (bolPivotSelected=False) Then
		Exit Sub
	End If

	objPivotTable.PivotManager.ColumnDimension(0).MoveToRow(1)
	objPivotTable.PivotManager.RowDimension(0).MoveToColumn(0)
	objItem.Deactivate

End Sub