Custom filter

A

Angela

I need to create a customised filter whereby the view will only filter
results if the predessor has been completed. Is this possible?

Angela
 
R

Rod Gill

Sorry, no. Filter data (and custom field formulae) only access data for the
same task. To read data from other tasks requires a VBA Macro.

I use a macro that runs when any project is saved: it tests all predecessors
of any milestone under a Summary Task called Deliverables and sets them to
100% complete if all their predecessor tasks are complete. Put the following
code in a Module:


Sub MilestonesUpdateComplete(Tsks As Tasks)
Dim Tsk As Task
Dim TskPred As Task
Dim Done As Boolean
For Each Tsk In ActiveProject.Tasks("Deliverables").OutlineChildren
If Tsk.PredecessorTasks.Count > 0 And Tsk.Milestone Then
Done = True
For Each TskPred In Tsk.PredecessorTasks
If TskPred.PercentComplete < 100 Then
Done = False
Exit For
End If
Next TskPred
If Done Then
Tsk.PercentComplete = 100
End If
End If
Next Tsk
End Sub


And this code in the ThisProject file:

Private Sub Project_BeforeSave(ByVal pj As Project)
On Error Resume Next
If Not pj Is Nothing Then
If Not pj.Tasks("Deliverables") Is Nothing Then
MilestonesUpdateComplete
pj.Tasks("Deliverables").OutlineChildren
End If
End If
End Sub


For more VBA tips, come hear me talk at the project Conference in Phoenix Az
next Tuesday!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
R

Rob Schneider

There might be a way that avoids VBA, but I can't think of such a way at
this moment.

Therefore, if required to do this I would write a small VBA program that
goes through all tasks. For each task look at all immediate predecessor
tasks (there may be more than one), and if any of them are complete,
then would set the value of the new custom task field for that task,
called [Predecessor Complete] equal to Yes. Then I would make a filter
which looks for [Predecessor Complete]=Yes.

--rms

www.rmschneider.com
 
A

Angela

Many thanks for the responses. I didn't think it was possible but glad
you've clarified. I don't really know that much about VBA Macro's but will
attempt to give this one a go.

Angela
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top