You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
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