View Single Post
 
Old 01-07-2022, 11:39 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If you have already marked the cells contents as bold and red or green then the following will shade the cells, although the colour you quoted is in fact a pale green?

Code:
Sub Macro1()
Dim oTable As Table
Dim oCell As Cell
    For Each oTable In ActiveDocument.Tables
        For Each oCell In oTable.Range.Cells
            If oCell.Range.Font.Bold = True Then
                If oCell.Range.Font.ColorIndex = wdRed Or _
                   oCell.Range.Font.ColorIndex = wdGreen Then
                    oCell.Shading.BackgroundPatternColor = -654246093
                End If
            End If
        Next oCell
    Next oTable
    Set oTable = Nothing
    Set oCell = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote