View Single Post
 
Old 03-04-2015, 05:21 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
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 ofgmayor has much to be proud of
Default

Provided the green colour is that shown in the sample, the following will mark the text in those green cells as hidden/unhidden.

Code:
Sub ToggleTextInGreenCells()
Dim oTable As Table
Dim oCell As Cell
Dim oRng As Range
    For Each oTable In ActiveDocument.Tables
        For Each oCell In oTable.Range.Cells
            If oCell.Shading.BackgroundPatternColor = RGB(194, 214, 155) Then
                Set oRng = oCell.Range
                oRng.End = oRng.End - 1
                If oRng.Font.Hidden = True Then
                    oRng.Font.Hidden = False
                Else
                    oRng.Font.Hidden = True
                End If
            End If
        Next oCell
    Next oTable
lbl_Exit:
    Set oTable = Nothing
    Set oCell = Nothing
    Set oRng = Nothing
    Exit Sub
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