Share via

Conditional formatting based on task level in MS Project

Anonymous
2012-10-03T20:40:41+00:00

Win7 - MSP 2010

Does MSP have CF?  Is it possible to specify the font color of the task based on what indent level it has. I have a long-winded multi project (program level) plan and since my VP wants to be able to see which modules can be independently developed and farmed out, I will like to have the same color for the app titles, and the same color for the modules therein, and the same color for the sub-level tasks. I don't think I'm going deeper than 4 levels: ProgramPhase>Apps>Modules>ProjectPhase (i.e. design, dev, test)>Tasks. I would prefer not to do this manually across 300 rows :-).

On a more complex level, can I assign colors at the timeline view based on task type as well. So those colors on the task sheet would carry if I place them on a timeline. This is just a wish, I think I know the answer to this one but I could be wrong. Or I hope to be. :-)

Thanks - Hile

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-10-04T09:08:10+00:00

Hello John/Hile,

I agree with John's responses to both questions, but the one thing I'd add is that the for/next loop method of applying formatting can be slow on views with many rows. A VBA alternative is to use filters to identify the rows that need to be formatted, then select the columns and apply formatting en-masse.

I've given an example of how to do this on another thread:

http://social.msdn.microsoft.com/Forums/en-US/projectprofessional2010general/thread/e2fd5a05-8803-4d66-a201-ab0f40cbdde6

If you're not ready to bite the bullet and step into VBA, you could manually use the same method to apply conditional formatting to your schedule - i.e. set up filters to identify the tasks that you want formatted, then periodically apply each filter, and apply the formatting that you want to the tasks identified by the filter.

Hope this helps,

Andrew

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. John Project 49,710 Reputation points Volunteer Moderator
    2012-10-04T02:59:13+00:00

    Hile,

    Project does have a limited conditional formatting capability, (i.e. Format/Format group/Text Styles), but it won't handle what you want to do. To color code various levels and "modules" you basically have two choices, manual formatting or use a VBA macro.

    I don't know all the specifics of what you want but here is a starting point for a macro that will color the font of summary lines as:

    Outline level 1 > Red

    Outline level 2 > Green

    Outline level 3 > Teal

    Sub ColorFormatOL()

    Dim t As Task

    Dim i As Integer

    SelectTaskColumn

    i = 0

    For Each t In ActiveSelection.Tasks

    If Not t Is Nothing Then

    i = i + 1

    If t.Summary Then

    SelectTaskField row:=i, Column:="name", rowrelative:=False

    Select Case t.OutlineLevel

    Case 1

    FontEx Color:=pjRed

    Case 2

    FontEx Color:=pjGreen

    Case 3

    FontEx Color:=pjTeal

    End Select

    End If

    End If

    Next t

    End Sub

    As to the second part of your question, I haven't used the timeline enough to have a definitive answer but I'm pretty certain it is "no".

    Hope this helps.

    John

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. John Project 49,710 Reputation points Volunteer Moderator
    2016-11-27T15:31:12+00:00

    reza1615,

    That's correct. I clearly stated in my response that the code colors summary rows. Are you asking for an update to include all tasks at a particular outline level? If so, how many tasks in your file? Also, is your file a single project file or a master with inserted subprojects?

    John

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-11-27T03:55:19+00:00

    This code needs to have more loop. now it only changes the text of the first row in a level for example g,h,i,j wasn't colored.

    Was this answer helpful?

    0 comments No comments
  4. John Project 49,710 Reputation points Volunteer Moderator
    2012-10-04T15:33:02+00:00

    Andrew,

    If only the summary lines are being formatted I agree that a pre-filter is a faster way to go, however it wasn't clear to me from the post that summary lines are the only thing to be formatted. My intent was to provide a framework for the macro.

    John

    Was this answer helpful?

    0 comments No comments