Sunday, May 21, 2006

Project2k3: Highlight completed task

I got a question on how to highlight the row of a completed task in MS Project to Red color.

To accomplish this, you need to write a VBA macro and run this macro after you finish updating your project.

Here is the macro that does the work.


Sub MarkCompletedTask()
Dim startRow As Integer
Dim tsk As task
Dim today As Date

startRow = 1
today = Date

SelectRow Row:=startRow, RowRelative:=False
Set tsk = ActiveCell.task
If tsk Is Nothing Then
Exit Sub
End If

Application.ScreenUpdating = False

Do While True
If tsk.PercentComplete = 100 Then
Font Color:=1
Else
Font Color:=16
End If

startRow = startRow + 1
SelectRow Row:=startRow, RowRelative:=False

Set tsk = ActiveCell.task
If tsk Is Nothing Then
Exit Do
End If
Loop

Application.ScreenUpdating = True
End Sub

Labels:

0 Comments:

Post a Comment

<< Home