Microsoft Excel - FILTER PIVOT BASED ON A RANGE
Asked By Cherifa Hima on 19-Feb-13 01:13 PM
Hi,
I need to filter a pivottable based on a range named Hotel. I created the below code but it is not working. Any idea how to fix it? Thanks.
Sub Macro1()
Dim Hotel As Range
Dim H As Range
Dim HE as integer
Set H = Names("Hotel").RefersToRange
For Each Hotel In H.Cells
HE = Hotel.Value
With ActiveSheet.PivotTables("PivotTable1").PivotFields("resort_id").PivotItems("HE").Visible = False
End With
Next
End Sub