Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Noting Table Rows Containing a Character.
Written by Allen Wyatt (last updated June 21, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Sub HilightRows()
Dim TargetText1 As String
Dim TargetText As String
Dim oRow As Row
'initialize the target characters to find
TargetText = "("
TargetText1 = ")"
'Make sure we're in a table
If Selection.Information(wdWithInTable) Then
'Clear all the old shading
Selection.Tables(1).Shading.BackgroundPatternColor = wdColorWhite
'do all the rows
For Each oRow In Selection.Tables(1).Rows
If InStr(oRow.Range.Text, TargetText) > 0 Then _
oRow.Shading.BackgroundPatternColor = wdColorYellow
If InStr(oRow.Range.Text, TargetText1) > 0 Then _
oRow.Shading.BackgroundPatternColor = wdColorYellow
Next oRow
End If
End Sub
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11435) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Noting Table Rows Containing a Character.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!
Need a quick shortcut to jump to the top or bottom of a table column? Here's the two shortcuts you are searching for.
Discover MoreExcel makes it very easy to add sequential numbers to a range of cells. Not so in Word's tables, where adding such ...
Discover MoreTables are often used to organize information into an understandable format. If your company requires that tables in ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments