# MS Project Change Text Color in Row based on Status Field

I am looking to change the color of the text for an entire row based on what is indicated in the “Status” field.

I have searched other forums and have found solutions that are close, but nothing that really does what I am looking for. I am aware of the highlight feature and of the conditional formatting, but I can’t get them to do what I need. I wrote some VB code to do this exact thing about 5 years ago, but I am a novice, it took me about 5 days to write the very basic code, and then I lost it when I left my last job. 🙁

So, I am looking to just have some VBA that will do the following:

• If Status = “Late” then color the text in the row to “RED”
• If Status = “On Schedule” then color the text in the row to “GREEN”
• If Status = “Future Task” then color the text in the row to “BLACK”
• If Status = “Complete” then color the text in the row to “GRAY”

I would love to get advanced and have something like the following:
If Status = “On Schedule”, AND % complete is < 85%, AND “Finish Date” is < 5 days in future, then color the text in the row “ORANGE”

Super User Asked by Cobra75007 on November 22, 2021

Sub CompletePercentSub()

Dim t As Task Dim i As Integer

'Iterates through the entire ms project file

i = 1 For Each t In ActiveProject.Tasks

SelectRow Row:=i, RowRelative:=False

If Not t Is Nothing Then

Select Case t.Status
Case 0 'Complete
Font32Ex CellColor:=&H98FB98 'LIGHT GREEN
Case 1 'On Schedule
Font32Ex CellColor:=&HE0FFFF 'TAN
Case 2 'Late
Font32Ex CellColor:=&HC0FF& 'LIGHT RED
Case 2 'Future Task
Font32Ex CellColor:=&HFFFFFF 'WHITE
End Select
End If


i = i + 1

Next t

End Sub

Answered by user760527 on November 22, 2021

## Related Questions

### How to stop tray notifications of past app crash every time I launch it?

1  Asked on August 4, 2020 by techhorse

### Speeding up a fan running in ‘dumb’ mode

1  Asked on August 3, 2020 by laserguy

### Add myself as owner again of a team in Microsoft Teams

1  Asked on August 1, 2020 by finn-rup-nielsen

### Optical data discs recognized writeable/empty all the time

1  Asked on July 29, 2020 by igrimpe

### How to disable go to next search result with Cmd+F in Google Chrome?

2  Asked on July 27, 2020 by saadq

### Two Interfaces and lost packages

1  Asked on July 26, 2020 by cicekadam

### my pc switches off after using it for long time

4  Asked on July 26, 2020 by aarav-prasad

### Show entire messages in Thunderbird 3’s thread view?

2  Asked on July 24, 2020 by marcusw

### Ask a Question

Get help from others!