PDA

View Full Version : Sleeper: Filter change dynamically



willer.reis
12-18-2013, 05:07 AM
Good morning,


I'm new to the forum and also to VBA development.
Need to develop a macro to change filters (one by one) in a dynamic table according to a timer.
Developed a principle, but do not know how to continue, or carry.



Dim Alarm
Const IntervaloSegundos = '5 5 second intervals

Sub Start ()
Alarm TimeSerial = Now + (0, 0, IntervaloSegundos)
Application.OnTime EarliestTime: = Alarm, procedure: = "Macro1", Schedule: = True
end Sub

Sub Macro1 ()
Call Log
Call changeFilter ("Name", "Table1")
end Sub

Sub changeFilter (ByVal filter As String, ByVal table As String)
The PivotTable Dim pt
Set pt = Worksheets ("Sheet2"). PivotTables (table)
pt.PivotFields (filter). ClearAllFilters
pt.PivotFields (filter). CurrentPage = "Test" 'New filter set but grin. At this point I would make a loop to go through all filters.
end Sub


Help me please.
Thanks =D

Bob Phillips
12-18-2013, 01:00 PM
Could you explain in a few more words what you are trying to achieve, describe the overall objective, and such.

willer.reis
12-19-2013, 03:16 AM
Could you explain in a few more words what you are trying to achieve, describe the overall objective, and such.

I need a pivot table to change the filters (one after another) automatically in 5 seconds 5.

Bob Phillips
12-20-2013, 09:33 AM
Come on, that is what you said originally. What filters, change them to what, what for, etc. etc.