Sub MaterialsCost() Dim Tsk As Task Dim Res As Resource Dim Assgn As Assignment For Each Tsk In ActiveProject.Tasks If Not Tsk Is Nothing Then Tsk.Cost1 = 0 For Each Assgn In Tsk.Assignments Set Res = ActiveProject.Resources(Assgn.ResourceID) If Res.Type = pjResourceTypeMaterial Then Tsk.Cost1 = Tsk.Cost1 + Assgn.Cost End If Next Assgn End If Next Tsk End Sub