Search the Dynamic Table with a macro

Asked

Viewed 249 times

0

I’m trying to set a button to copy the value of a cell, paste it into one of the children of the dynamic table 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 however when I change the value of the Cell H3 the same no longer works. I need that when I change the value of ("H3") this value comes to PivotItems("H3").Visible = True.
I don’t know if I’ve been able to explain it correctly.

1 answer

0

Try adding a dynamic table update at the end of the code:

ActiveSheet.PivotTables("Tabela dinâmica2").PivotCache.Refresh

Browser other questions tagged

You are not signed in. Login or sign up in order to post.