Change pivot column with drop down or combo box

antmon

New Member
Joined
Mar 2, 2017
Messages
1
Hi All,

I am trying to replace a column in a pivot table using a drop down or Combo box.

When recording a macro and doing it manually I get this

Sub Macro2()
ActiveSheet.PivotTables("MainPivotTable").CubeFields("[ETO].[Site Manager]"). _
Orientation = xlHidden
With ActiveSheet.PivotTables("MainPivotTable").CubeFields("[ETO].[Suburb]")
.Orientation = xlRowField
.Position = 1
End With
End Sub

I have also found online someone who can change the data source using a combo box
Sub ChangeDataSource()
With ActiveSheet.Shapes(Application.Caller).ControlFormat
ActiveSheet.PivotTables("PivotTable1").PivotTableWizard SourceType:=xlDatabase, SourceData:= _
.List(.Value)
End With
End Sub

Is there a way to modify the second query to change the pivot columns instead (or even the pivot values)
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top