Ir ao conteúdo
  • Cadastre-se

FelipeAmorim

Membro Júnior
  • Posts

    3
  • Cadastrado em

  • Última visita

Reputação

1
  1. Olá Osvaldo. Funcionou perfeitamente. Muito obrigado. Quanto ao tratamento de erro, eu também não sei a função dele porque eu obtive o código da internet e com sua ajuda apliquei para minha necessidade, que era uma quantidade maior de filtros e tabelas. Mas de qualquer forma funcionou normalmente. Novamente muito obrigado pela ajuda. Abs
  2. Olá Osvaldo. você tem razão, no terceiro é tabela2. Eu já editei o post. Obrigado pela observação.
  3. Pessoal, podem me ajudar por favor? Contextualizando, descobri um código que ao inserir um parâmetro em uma célula, ele ativa o filtro da tabela dinâmica em outra sheet. Por exemplo, na sheet "Dashbord", eu digito o ano 2018 na célula "E9", e automaticamente é ativado o filtro "Ano" na tabela dinâmica da sheet "Dinamicas". Este código é um "Worksheet_Change". O problema é que preciso filtrar mais de um parâmetro e em mais de uma tabela dinâmica. Por exemplo, preciso digitar os parâmetros "Ano" e "Unidade" na sheet "Dashboard" e ativar o filtro na "tabela1" e "tabela2 da sheet "Dinamicas". Como eu poderia unificar estas quatro "Worksheet_Change"? Private Sub Worksheet_Change(ByVal Target As Range) Dim xPTable As PivotTable Dim xPFile As PivotField Dim xStr As String On Error Resume Next If Intersect(Target, Range("E9")) Is Nothing Then Exit Sub Application.ScreenUpdating = False Set xPTable = Worksheets("Dinamicas").PivotTables("Tabela1") Set xPFile = xPTable.PivotFields("Ano") xStr = Target.Text xPFile.ClearAllFilters xPFile.CurrentPage = xStr Application.ScreenUpdating = True End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim xPTable As PivotTable Dim xPFile As PivotField Dim xStr As String On Error Resume Next If Intersect(Target, Range("E10")) Is Nothing Then Exit Sub Application.ScreenUpdating = False Set xPTable = Worksheets("Dinamicas").PivotTables("Tabela1") Set xPFile = xPTable.PivotFields("Unidade") xStr = Target.Text xPFile.ClearAllFilters xPFile.CurrentPage = xStr Application.ScreenUpdating = True End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim xPTable As PivotTable Dim xPFile As PivotField Dim xStr As String On Error Resume Next If Intersect(Target, Range("E9")) Is Nothing Then Exit Sub Application.ScreenUpdating = False Set xPTable = Worksheets("Dinamicas").PivotTables("Tabela2") Set xPFile = xPTable.PivotFields("Ano") xStr = Target.Text xPFile.ClearAllFilters xPFile.CurrentPage = xStr Application.ScreenUpdating = True End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim xPTable As PivotTable Dim xPFile As PivotField Dim xStr As String On Error Resume Next If Intersect(Target, Range("E10")) Is Nothing Then Exit Sub Application.ScreenUpdating = False Set xPTable = Worksheets("Dinamicas").PivotTables("Tabela2") Set xPFile = xPTable.PivotFields("Unidade") xStr = Target.Text xPFile.ClearAllFilters xPFile.CurrentPage = xStr Application.ScreenUpdating = True End Sub Obrigado Felipe

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...