【发布时间】:2017-08-23 08:57:21
【问题描述】:
我正在根据完成百分比和 text10 列中的名称更改 MS Project 中的字体颜色。百分比有效,但是有人能给我指导一下我会感激的名字吗,如果例如“David”或“Darren”或两者都在Text10字段中,我想用蓝绿色突出显示。
感谢您的任何帮助。
Sub text()
Dim Ctr As Integer
ViewApply "Gantt Chart"
OutlineShowAllTasks
FilterApply "All Tasks"
SelectAll
For Ctr = 1 To ActiveSelection.Tasks.Count
SelectRow Row:=Ctr, rowrelative:=False
If Not ActiveSelection.Tasks(1) Is Nothing Then
If ActiveSelection.Tasks(1).Text10 = ("David") & ("Darren") Then
Font Color:=pjTeal
Else
If ActiveSelection.Tasks(1).PercentComplete = 100 Then
Font Color:=pjGreen
Else
If ActiveSelection.Tasks(1).PercentComplete = 0 Then
Font Color:=pjBlack
Else
If ActiveSelection.Tasks(1).PercentComplete > 0 < 100 Then
Font Color:=pjBlue
Else
End If
End If
End If
End If
End If
Next Ctr
End Sub
【问题讨论】:
-
未来的你(和/或你的代码的未来维护者)会高兴有这样的缩进...查看我的 OSS 项目的@987654321 @,它会自动为您解决此问题。
-
@Mat'sMug 一定会喜欢 Ducky :)
标签: vba fonts colors ms-project