Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Shading Table Rows.

Shading Table Rows

by Allen Wyatt
(last updated December 28, 2013)

In Excel it is possible to use conditional formatting to shade every other row (or every nth row) of a data table. You may want to accomplish the same task in Word, and the program provides several approaches you can take.

One approach is to use the AutoFormat capabilities of Word on your table. Follow these steps:

  1. Create your table as you normally would.
  2. Place the insertion point somewhere within the table.
  3. Choose the Table AutoFormat option from the Table menu. Word displays the Table AutoFormat dialog box. (See Figure 1.)
  4. Figure 1. The AutoFormat dialog box.

  5. In the list of available styles, choose one that uses shading on the table rows.
  6. Click Apply. The format is applied to the table.
  7. Close the Table AutoFormat dialog box.

Many of the AutoFormats provided for tables are "smart," meaning that they can adjust row shading even if you add new rows to the table. How is this done? Glad you asked; that leads to the second method of shading table rows—table styles.

Styles have been available in Word for years and years. One of the relatively recent additions to Word's style capabilities is styles for tables. You can define a table style that automatically applies shading to either the even or odd rows in a table. (This is how the Table AutoFormats do it.) Follow these steps:

  1. Choose Styles and Formatting from the Format menu. Word displays the Styles and Formatting task pane.
  2. In the task pane, click New Style. Word displays the New Style dialog box.
  3. Using the Style Type drop-down list, choose Table. (See Figure 2.)
  4. Figure 2. The New Style dialog box.

  5. Using the Apply Formatting To drop-down list, choose Odd Row Stripes or Even Row Stripes, depending on whether you want this style to apply to odd or even rows.
  6. Use the controls in the dialog box to set the formatting you want applied to the rows.
  7. Set the style name and other properties, as desired.
  8. Click OK.

You've now created a shading style for either odd or even rows. You can apply this style to the table, as desired. The formatting automatically adjusts as you change the number of rows in the table.

The solutions described so far work great if you want to apply formatting to every other row in a table, and provided you are using a version of Word that supports table formatting. They don't work so well if you want the formatting applied to every third, fourth, or fifth row or if you are using an older version of Word that doesn't include table formatting. In these instances it may be best to use a macro to do your formatting. The following is a good example of a macro that can apply shading to every third row in a table:

Sub ShadeRows()
    Dim iRow As Integer
    Dim iHeads As Integer
    Dim iRowTtl As Integer

    If Selection.Information(wdWithInTable) = True Then
        iHeads = InputBox(prompt:="Number of heading rows?", _
          Title:="Headings", Default:="1")

        iRowTtl = Selection.Tables(1).Rows.Count - iHeads
        For iRow = 1 To iRowTtl
            If iRow Mod 3 = 0 Then
                Selection.Tables(1).Rows(iRow + iHeads).Shading.Texture _
                  = wdTexture20Percent
            Else
                Selection.Tables(1).Rows(iRow + iHeads).Shading.Texture _
                  = wdTextureNone
            End If
        Next iRow
    End If
End Sub

The macro asks how many header rows are in the table, and then adjusts the rows to which it applies shading. If the insertion point is not within a table when the macro is run, then nothing happens. You can also change the frequency of shading (for instance, from every third row to every fourth) by changing the Mod formula. Simply change the single line, in this manner:

            If iRow Mod 4 = 0 Then

You can also change the amount of shading by changing the wdTexture20Percent constant to another, such as wdTexture5Percent, wdTexture10Percent, wdTexture25Percent, etc.

You should also understand that if you run the macro on a table where cells have been merged vertically, you may get unexpected results, if any. If you change the number of rows in a table, then you will need to run the macro again to reapply the shading.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (5814) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Shading Table Rows.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Quickly Changing Windows

Need to quickly move from one open Excel window to the other? The program provides a couple of handy shortcuts you can use, ...

Discover More

Removing Dashes from ISBN Numbers

ISBN numbers are used to denote a unique identifier for a published book. If you remove the dashes included in an ISBN, you ...

Discover More

Missing Left Border

Ever wonder why a border around a graphic doesn't print the way it looks on the screen? There are several ways to add and ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

MORE WORDTIPS (MENU)

Repeating Table Rows with Manual Page Breaks

Need to make sure part of a table is on one page and part on another? The way to do so is not to use manual page breaks, for ...

Discover More

Quickly Removing Table Borders

Insert a table in your document and Word assumes that you want borders around the table and its cells. Here's a shortcut that ...

Discover More

Copying Fill Color in a Table

You may spend some time getting the color in a portion of a table just right, only to be faced with the task of copying that ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing
Share