Search the pivot table with a macro
I'm trying to set up a button to copy the value of a cell, paste into one of the pivot table's children and give ok.
Sub Botão17_Clique()
'
' Botão17_Clique Macro
'
'
Range("H3").Select
Selection.Copy
ActiveSheet.PivotTables("Tabela dinâmica2").PivotFields("Dispositivo Operado"). _
CurrentPage = "(All)"
With ActiveSheet.PivotTables("Tabela dinâmica2").PivotFields( _
"Dispositivo Operado")
.PivotItems("691441").Visible = True
End With
End Sub
The Button works but when I change the value of the cell H3
the same does not work anymore. I need that when I change the value of ("H3")
that value comes to PivotItems("H3").Visible = True
.
I don't know if I could explain it correctly.
0
1 answers
Try adding a pivot table update at the end of the Code:
ActiveSheet.PivotTables("Tabela dinâmica2").PivotCache.Refresh
0
Author: phduarte, 2019-08-02 18:00:22