Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 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: Shading Table Rows.

Shading Table Rows

Written by Allen Wyatt (last updated November 24, 2018)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


3

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 some of the predefined table styles that Word makes available. Follow these steps:

  1. Create your table as you normally would.
  2. Place the insertion point somewhere within the table.
  3. Make sure the Design tab of the ribbon is displayed.
  4. Using the thumbnails in the Table Styles group, click one that uses shading on the table rows.

Many of the table formats 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—creating your own table styles.

Styles have been available in Word for years and years. 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. Place the insertion point somewhere within a table.
  2. Make sure the Design tab of the ribbon is displayed.
  3. At the right side of the thumbnail images in the Table Styles group you'll notice up and down arrows. Under this is a drop-down arrow. Click it to display the full range of table styles defined in Word.
  4. Click the New Table Style option. Word displays the Create New Style from Formatting dialog box. (See Figure 1.)
  5. Figure 1. The Create New Style from Formatting dialog box.

  6. Using the Apply Formatting To drop-down list, choose Odd Banded Rows or Even Banded Rows, depending on whether you want this style to apply to odd or even rows.
  7. Use the controls in the dialog box to set the formatting you want applied to the rows.
  8. Set the style name and other properties, as desired.
  9. 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. They don't work so well if you want the formatting applied to every third, fourth, or fifth row. In this instance 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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (6699) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word 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

Putting Cell Contents in Footers

Referencing information between cells in a worksheet is a piece of cake using some elemental formulas. You cannot, ...

Discover More

Separating Evens and Odds

If you have a series of values in a column, you might have a need to separate the values into even values and odd values. ...

Discover More

Merging Cells to a Single Sum

One way to make your worksheets less complex is to get rid of detail and keep only the summary of that detail. Here's how ...

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 (ribbon)

Hiding Table Gridlines, by Default

The edges to table cells are shown two ways in Word: gridlines and borders. Table gridlines are only seen in Word; they ...

Discover More

Aligning Positive and Negative Whole Numbers in a Column

When you use a table to present numeric information, you may want to have Word align the numbers in the table. This can ...

Discover More

Fitting Text Into Cells

Need a way to make sure your text fits within the space available in a table cell? Word has a handy setting that will ...

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

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

2022-04-05 07:26:36

Pieter

This is a really useful tip - thank you.
I was hoping that you might be able to help me set the font characteristics as well. I know that this requires the Range property, but my skills are not up to converting the selection to a range. I'd appreciate some help, please.


2018-11-26 16:36:02

Paul Stregevsky

Unfortunately, Word's Table Styles dialog assumes that you will use be using only one header row. You can't specify "Give me a two-row header" in the style. If you add header row 2 later, your alternate-row shading will be thrown off. Specifically, your lower header row will now be mistaken for your first body row. That's unfortunate, because a double header row can be useful for two reasons:
1. To separate a spanned column heading from column subheadings.
2. To place the table title in an invisible top row that will repeat if the table continues onto a new page.


2018-11-24 11:11:44

Robert Zimmerman

Word Help shows the MOD formula with the two required arguments within parenthesis. Your Macro separates the arguments without using parenthesis, placing the first (represented by the variable iRow) before the MOD formula and the second argument after the formula. I'm wondering how you determined the separation would work with the MOD formula.


This Site

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.

Videos
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.