VBA to link combo box to multiple pivot tables

Taylort

New member
Joined
Jul 8, 2014
Messages
1
Reaction score
0
Points
0
Please help.
I am trying to link a combo box to multiple pivot tables. Pease help. I continue to get error messages

Sub Combo_Change()
Dim pvtTable As PivotTable
Dim pvtField As PivotField
Dim pvtItem As PivotItem
Dim filterName As String

On Error Resume Next
Set pvtTable = Worksheets("Dashboard").PivotTables("Actual")
Set pvtField = pvtTable.PivotFields("Building_COID")
filterName = Worksheets("Dashboard").Range("Building_COID")
For Each pvtItem In pvtField.PivotItems
If pvtItem.Value = "(All)" Then
pvtField.CurrentPage = "(All)"
Else
pvtField.CurrentPage = filterName
Exit For
End If
Next pvtItem
 
Back
Top