I am trying to change the fields in a pivot table based upon a selection from a dropdown or combobox. I recorded the following macro as a start, but don't know how to adjust it to make it dynamic with the selection from the box:
Sub OrderType()
Sheets("Pivot").Select
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveSheet.PivotTables("PivotTable5").PivotFields("Channel").Orientation = xlHidden
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Order Type")
.Orientation = xlColumnField
.Position = 1
End With
End Sub
The "Channel" was the old field that needs to be replaced with the new selection (in this case "Order Type").
Any ideas?
Sub OrderType()
Sheets("Pivot").Select
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveSheet.PivotTables("PivotTable5").PivotFields("Channel").Orientation = xlHidden
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Order Type")
.Orientation = xlColumnField
.Position = 1
End With
End Sub
The "Channel" was the old field that needs to be replaced with the new selection (in this case "Order Type").
Any ideas?