none
Filtering-find tasks that include a particular resource in subtasks? MicrosoftProject 2010 RRS feed

  • Question

  • Hello everyone,

    I'm actualy working on a project on MicrosoftProject 2010. I met a problem when I would use the filter. I will try to explain:

    My project is built as below:

    Task A
    sub task A/resource Bert
    sub task A/resource ERNIE
    sub task A/resource Ralph
    Task B
    sub Task B/resources ERNIE
    Sub task B/resource Ralph
    Task C
    Sub Task C/resource Bert
    Sub Task C/resource Ralph

    I want to present to Ernie all the projects he's involved in, showing all the sub tasks. In this case it would be Task A and all three sub tasks, and Task B and both sub tasks. Task C and its sub tasks would be filtered out since Ernie is not involved at all.

    I tried all the options that I am able to do so I really need an help . I would precise that I've a lot of tasks and sub tasks in the project and it would be unthinkable to do by hand each time I've to present the project to one of my coworker.

    Somebody advise me to use Excel to filter but I would like to keep the Project presentation and all the link of the planification. Therefore they propose to use a code in Microsoft Project.

    Unfortunately I've some difficulties for coding but I can understand it. It just lack me the framework and i'll try the rest. It's for why I post on this forum. Does somebody can help me?

    Thank you in advance.

    Grub'

    Friday, October 31, 2014 2:04 PM

Answers

  • Grub,

    I tried a couple of things with grouping and filtering but couldn't come up with anything to meet your criteria so I wrote this macro. It's a little crude but it does what you want.

    Option Compare Text
    Sub ResNamAndSumm()
    Dim t As Task
    Dim ch As Task
    Dim Nam As String
    'first clear all tasks from previous run
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            t.Flag1 = False
        End If
    Next t
    'request resource name
    Nam = InputBox("Enter resource name")
    FilterEdit Name:="grub", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="Resource Names", test:="contains", Value:=Nam, ShowInMenu:=False, showsummarytasks:=False
    FilterApply Name:="grub"
    SelectAll
    'find tasks with resource, set flag for task and it's parent
    For Each t In ActiveSelection.Tasks
        If Not t Is Nothing Then
            t.Flag1 = True
            t.OutlineParent.Flag1 = True
        End If
    Next t
    FilterApply Name:="all tasks"
    'go back and set flag for all sibling tasks
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If t.Summary = True And t.Flag1 = True Then
                For Each ch In t.OutlineChildren
                    ch.Flag1 = True
                Next ch
            End If
        End If
    Next t
    'apply final filter
    FilterEdit Name:="grub1", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="Flag1", test:="equals", Value:="yes", ShowInMenu:=False, showsummarytasks:=False
    FilterApply Name:="grub1"
    End Sub

    Hope this helps.

    John

    Friday, October 31, 2014 3:51 PM

All replies

  • Grub,

    I tried a couple of things with grouping and filtering but couldn't come up with anything to meet your criteria so I wrote this macro. It's a little crude but it does what you want.

    Option Compare Text
    Sub ResNamAndSumm()
    Dim t As Task
    Dim ch As Task
    Dim Nam As String
    'first clear all tasks from previous run
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            t.Flag1 = False
        End If
    Next t
    'request resource name
    Nam = InputBox("Enter resource name")
    FilterEdit Name:="grub", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="Resource Names", test:="contains", Value:=Nam, ShowInMenu:=False, showsummarytasks:=False
    FilterApply Name:="grub"
    SelectAll
    'find tasks with resource, set flag for task and it's parent
    For Each t In ActiveSelection.Tasks
        If Not t Is Nothing Then
            t.Flag1 = True
            t.OutlineParent.Flag1 = True
        End If
    Next t
    FilterApply Name:="all tasks"
    'go back and set flag for all sibling tasks
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If t.Summary = True And t.Flag1 = True Then
                For Each ch In t.OutlineChildren
                    ch.Flag1 = True
                Next ch
            End If
        End If
    Next t
    'apply final filter
    FilterEdit Name:="grub1", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="Flag1", test:="equals", Value:="yes", ShowInMenu:=False, showsummarytasks:=False
    FilterApply Name:="grub1"
    End Sub

    Hope this helps.

    John

    Friday, October 31, 2014 3:51 PM
  • It work! Thank you so much Jonh to have took time to help me.

    Good continuation to you

    Grub'


    Monday, November 3, 2014 3:27 PM
  • Grub,

    You're welcome and thanks for the feedback. If this answered your question please mark my initial response as the answer.

    John

    Monday, November 3, 2014 4:42 PM