Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. Sub ComboBox1_Change()
  2. Dim pt As Pivot Table
  3. Dim pf As PivotField
  4. Dim cbo As ComboBox
  5.  
  6. Set pt = ActiveSheet.PivotTables("PivotTable1")
  7.  
  8. For Each pf In pt.RowsFields
  9. If pf.Name <> "Values" Then
  10. pf.Orientation = xlHidden
  11. End if
  12. Next pf
  13. If cbo = "customer" Then
  14.  
  15.  
  16. Activesheet.PivotTables("PivotTable1").PivotFields("Customer").Orientation = xlRowField
  17.  
  18. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement