Hello,
I would like to automatically hide a row in my pivot table when a cell in column "Exclude" (column O) is equal to "x".
I currently have the code below which is refreshing my pivot when cells in I7:J7 are updated and it's working beautifully. When I try to include code in bold below to hide rows in column O when cells are equal to "x", it does not work.
Any help is very appreciated.
Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("I7:J7")
If Not Application.Intersect(KeyCells, Target) Is Nothing Then
Worksheets("CST View").PivotTables("AutoOL").PivotCache.Refresh
ElseIf Range("O:O") = "x" Then
Rows("O:O").EntireRow.Hidden = True
End If
End If
End Sub
Thank you
I would like to automatically hide a row in my pivot table when a cell in column "Exclude" (column O) is equal to "x".
I currently have the code below which is refreshing my pivot when cells in I7:J7 are updated and it's working beautifully. When I try to include code in bold below to hide rows in column O when cells are equal to "x", it does not work.
Any help is very appreciated.
Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("I7:J7")
If Not Application.Intersect(KeyCells, Target) Is Nothing Then
Worksheets("CST View").PivotTables("AutoOL").PivotCache.Refresh
ElseIf Range("O:O") = "x" Then
Rows("O:O").EntireRow.Hidden = True
End If
End If
End Sub
Thank you