Hi I have a spreadsheet with a macro and the code is like this
Sub Macro13()
Dim pvtItem As PivotItem
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Department")
For Each pvtItem In .PivotItems
pvtItem.Visible = pvtItem.Name = "Department 2"
Next pvtItem
End With
End Sub
Is it possible rather than putting what department to select in VBA like "Department 2", the input can be taken from a cell from the workbook? I mean so I have to only change lets say value in A1 to Department 1 and then the code works?
Can anyone please suggest code for that?
I have also posted this on mrexcel forum http://www.mrexcel.com/forum/excel-q...vot-macro.html
Bookmarks