I have few tasks in ms project. They are grouped with few summary tasks, so the progress of work completed is tracked by those summary tasks. I need to add one separate single task which will summarize all progress from some of the summary tasks and some of single tasks. All tasks that need to be summarized will be linked as predecessors for this final summary task.
I've wrote code like this bellow but I'm struggling to make it work as intended.
Sub SumProgress()
Dim t As Task, subt As Task
Dim NumSub As Integer, TotalProgres As Integer, TaskProgres As Integer
Set area = ActiveProject.Tasks
For Each t In area
If t.Flag10 = True Then
NumSub = Int(t.PredecessorTasks.Count)
For Each subt In t.PredecessorTasks
TotalProgres = TotalProgres + Int(subt.PercentComplete)
Next subt
t.PercentComplete = TotalProgress / NumSub
End If
Next t
End Sub