Excel VisualBasic Script

Sub AddFieldsToTable()
         With ActiveSheet.PivotTables(1)
             .AddFields RowFields:="State", AddToTable:=True
             .PivotFields("Date").Orientation = xlPageField
         End With
     End Sub