Я хочу очистить все поля Значения в моей сводной таблице мощности
Sub RemoveValueFields()
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Set pt = ActiveSheet.PivotTables("Invoices")
'remove calculated fields first,
'if any exist
For Each pf In pt.CalculatedFields
For Each df In pt.DataFields
If df.SourceName = pf.Name Then
With df
.Parent.PivotItems(.Name) _
.Visible = False
End With
Exit For
End If
Next df
Next pf
For Each pf In pt.DataFields
pf.Orientation = xlHidden 'I get an error here Unable to set the Orientation property of the PivotField class
Next pf
End Sub
Я нашел этот ответ здесь для столбца полей: Как удалить все поля столбца в сводной таблице (Power Pivot)?
но я не уверен, как бы я приспособил это к Полям Значений ...