none
stepping through tasks filtered using 'AutoFilter' RRS feed

  • Question

  • MS Project 2007 does not seem to give me the ability to step through the tasks selected by using some kind of AutoFilter property?

    In Excel you can interrogate the Hidden property of a row?

    I am looking for something that looks like the code below but steps through the tasks as selected using the AutoFilter feature:

    Sub SelectTasks()

        Dim T As Task, Names As String

        For Each T In ActiveSelection.Tasks
            Names = Names & T.Name & vbCrLf
        Next T

        MsgBox Names
           
    End Sub  


    Tuesday, May 3, 2011 6:14 PM

Answers

  • I'd use something like:

    'after the autofilter is applied

    Sub workWithFilteredTasks()
    Dim ts As Tasks
    Dim t As Task
    SelectAll
    Set ts = ActiveSelection.Tasks
    For Each t In ts
    MsgBox t.Name
    Next t
    End Sub

    Pretty similar to what you have

     

     


    Jack Dahlgren blogs at:
    Project and Retrovention
    and rarely Twitter
    • Marked as answer by pentico Wednesday, August 29, 2012 6:53 PM
    Wednesday, May 4, 2011 4:54 PM
    Moderator

All replies

  • pentico,

    As far as I can tell your simple macro only lacks one thing (other than the obvious expansion of the MsgBox statement). As written the code will step through the current selection, so unless you already selected the whole filtered set you will only get a result for one task - the currently selected one. I suggest you add the line:

    SelectTaskColumn just before the For Each... statement.

    Hope this helps.

    John

    Tuesday, May 3, 2011 9:09 PM
  • I'd use something like:

    'after the autofilter is applied

    Sub workWithFilteredTasks()
    Dim ts As Tasks
    Dim t As Task
    SelectAll
    Set ts = ActiveSelection.Tasks
    For Each t In ts
    MsgBox t.Name
    Next t
    End Sub

    Pretty similar to what you have

     

     


    Jack Dahlgren blogs at:
    Project and Retrovention
    and rarely Twitter
    • Marked as answer by pentico Wednesday, August 29, 2012 6:53 PM
    Wednesday, May 4, 2011 4:54 PM
    Moderator