Hi
I was wondering whether someone can help me with a seemingly simple question (im new to VB)
I have a code which tries to apply a filter to my pivot table base on a value in a cell. So for example, in code below if ValCell is Mens then the pivot table would filter Men from Division Only.
I have the following Code
Sub PassVal(Name)
MsgBox ("Diviosion Selected is " & Name)
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Dept No].[Division].[Division]").VisibleItemsList = Array( _
"[Dept No].[Division].&[Mens]")
End Sub
The Name is passed thorough from this Code
Sub DivSelect()
Dim Division As String
Dim Wb As Workbook
Set Wb = ActiveWorkbook
Division = Sheets("Sheet1").Cells(8, "C").Value
' MsgBox (Division)
Call PassVal(Division)
End Sub
What I need to do is to replace the Mens in first code ActiveSheet.Povottable.......... with a variable Name (which has the value of whatever selected in Sheet 1 Cells (8,"C").
Any help is appreciate it
Bookmarks