I've been having a problem hiding a calculated field in a Pivot Table in Excel 2003. I'm trying to hide a calculated field "BGT Var", and I get an error on the last line of code that states "Unable to set the Orientation property of the PivotField class. Does anyone have any idea how to hide a calculated field with VBA? Below is the code.
Code:
Sub Fin_Amt_Class_Select()
'On Error Resume Next
Dim pt As PivotTable
Dim ws As Worksheet
Set ws = Worksheets("Proj_Summ")
Set pt = ws.PivotTables("PivotTable1")
pt.PivotFields("BGT Var").Orientation = xlHidden
End Sub