PDA

View Full Version : Solved: update pivot tables based on the value of cell 'C2'



marreco
10-02-2012, 05:00 PM
Hi.
I have the tab labeled 'RESUMO MENSAL', 3 pivot tables.

I would like the selecionr the year 'C2' tables were atualizas filtering the year in the cells 'C2'

See my file in:
http://www.sendspace.com/file/snbwby

Thank you!

p45cal
10-03-2012, 05:32 PM
you could try this in the relevant sheet's code-module:Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "C2" Then
x = Application.Trim(Target.Value)
For Each pt In PivotTables
Select Case pt.Name
Case "TotJan", "Res_Jan", "Tabela dināmica1" 'ADJUST: include the names of the pivot tables you want to affect.
pt.PivotFields("ANO").EnableMultiplePageItems = False
pt.PivotFields("ANO").CurrentPage = x
End Select
Next pt
End If
End Sub

marreco
10-03-2012, 05:49 PM
my friend you are very good excel!!

was perfect!!

thank you very much!!