![]() |
|
#9
|
||||
|
||||
|
This is the basic code I would start with to match with your sample doc. You can adjust the colours and add a font handler if you need it but the automatic font colour you already have might be adequate for that.
Code:
Sub TrafficLights()
Dim aTbl As Table, aCell As Cell, sEff As String, sC2 As String
For Each aTbl In ActiveDocument.Tables
sEff = Trim(Split(aTbl.Cell(1, 1).Range.Text, vbCr)(0))
If sEff = "Effectiveness" Then
Set aCell = aTbl.Cell(1, 1).Next
sC2 = aCell.Range.Text
sC2 = Trim(Split(sC2, vbCr)(0))
Select Case sC2
Case "Weak"
aCell.Shading.ForegroundPatternColor = wdColorLightOrange
Case "Effective"
aCell.Shading.ForegroundPatternColor = wdColorBlue
Case "Adequate"
aCell.Shading.ForegroundPatternColor = wdColorGreen
Case "Not Applicable"
aCell.Shading.ForegroundPatternColor = wdColorIndigo
Case Else
aCell.Shading.ForegroundPatternColor = wdColorWhite
End Select
End If
Next aTbl
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Cell fill based on conditional formatting
|
allex011 | Excel | 7 | 07-07-2021 10:30 AM |
| Conditional format a button based off a value in a field | Triscia | Misc | 0 | 03-11-2015 11:12 AM |
| Conditional Formatting based on Value of Another Cell | SteveBump | Excel | 3 | 03-07-2014 09:16 AM |
How can I count cells based on their fill color that was set by conditional format
|
trueimage | Excel Programming | 1 | 10-25-2013 12:08 PM |
| Table with Conditional Format to Word | billyV | Excel | 9 | 06-07-2013 08:26 AM |