Microsoft KB Archive/118689

= PRJ: Rolling Up Cost Fields to the Summary Level Task =

Article ID: 118689

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Project 98 Standard Edition
 * Microsoft Project 4.1 Standard Edition
 * Microsoft Project 4.0 Standard Edition
 * Microsoft Project 4.0 for Macintosh

-



This article was previously published under Q118689



SYMPTOMS
Microsoft Project will not roll up Cost1, Cost2, Cost3, Fixed Cost, or Baseline Cost fields for a summary task from its subordinate tasks.

NOTE: Fixed Costs indirectly roll up to the summary task from the subordinate tasks via the Cost field (Cost = Fixed Cost + Resource Costs). Therefore, rolling up Fixed Costs from the subordinate tasks to the summary task is not appropriate.



WORKAROUND
You can create a Visual Basic, Applications Edition, macro that takes a cost field and associates the totals with the appropriate summary tasks.

The following macro loops through the outline levels (there are a maximum of 10 outline levels in Microsoft Project) and places the sum at the summary level.

IMPORTANT: If you run the following macro more than once, the macro will add additional costs to the existing values in the Cost1 field at the summary level. If you plan to run this macro more than once, you will need to reset the costs for the summary level task to zero.

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line- continuation character.

Sample Macro Code
Sub Costroll 'OL is a variable to count through the outline levels. 't is an object used to loop through the tasks in the active project. Dim t As Object Dim OL As Integer For OL = 10 To 1 Step -1 For Each t In ActiveProject.Tasks If Not t Is Nothing Then If t.OutlineLevel = OL = True Then t.OutlineParent.Cost1 = 0 End If Next t Next OL For OL = 10 To 1 Step -1 For Each t In ActiveProject.Tasks If Not t Is Nothing Then If t.OutlineLevel = OL Then t.OutlineParent.Cost1 = t.Cost1 + t.OutlineParent.Cost1 End If    End If   Next t Next OL End Sub Note that although this macro uses the Cost1 property, Cost2, Cost3, and BaselineCost are also properties of the Task object. Therefore, you can use any one of these properties in a similar macro to roll up costs for these fields.

Also note that this macro, as with other macros which work with either the Task or Resource collections, will not work on a consolidated project.



STATUS
This behavior is by design of Microsoft Project.

Additional query words: Roll Up Cost Rollup

Keywords: kbcode kbmacro kbprb KB118689

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.