Consulting

Results 1 to 4 of 4

Thread: Filter change dynamically

  1. #1

    Exclamation Filter change dynamically

    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
    Last edited by Zack Barresse; 12-20-2013 at 10:43 AM. Reason: Added VBA tags

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    Could you explain in a few more words what you are trying to achieve, describe the overall objective, and such.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Red face

    Quote Originally Posted by xld View Post
    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.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    Come on, that is what you said originally. What filters, change them to what, what for, etc. etc.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •