Easily Copying Cell Formatting

Written by Allen Wyatt (last updated May 14, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


Barry is often sent documents with manually applied shading in some of the table rows and he needs to apply the exact shading elsewhere. For other formatting he would probably use the Format Painter but, alas, it only copies the formatting of the text, not of the cell. Barry wonders about the easiest way to copy cell formatting from one place to another.

As far as I've been able to determine, there is no shortcut within Word that allows you to copy table cell formatting from one cell to another. You can, if you want, use the tried and true "repeat the last action" technique:

  1. Select the cell you want to format.
  2. Apply formatting to the cell.
  3. Select one or more other cells.
  4. Press F4.

This works because pressing F4 repeats the previous action you took in the document. Since the previous action was to apply some formatting to a cell (step 2), pressing F4 applies that same formatting to the other cells you selected in step 3.

This can get a bit tedious, though. A better way might be to create a macro to copy the formatting. Since Barry is dealing specifically with cell shading, I'll provide a macro that focuses just on that. Actually, there are two macros here:

Dim lbgc As Long

Sub SetColor()
    If Selection.Information(wdWithInTable) Then
        lbgc = Selection.Cells(1).Shading.BackgroundPatternColor
    Else
        MsgBox "Insertion point is not in a table."
    End If
End Sub
Sub ApplyColor()
    Dim c As Cell

    If Selection.Information(wdWithInTable) Then
        For Each c In Selection.Cells
            c.Shading.BackgroundPatternColor = lbgc
        Next c
    End If
End Sub

Note several things about these macros. First, you can see that a variable (lbgc) is defined outside of any of the macros. This is because the variable is used in both the SetColor and ApplyColor macros.

The SetColor macro is used to specify the background color you want to paste elsewhere. All you need to do is to place the insertion point within a table cell and then run the macro. It takes the background color and places it in the lbgc variable. If you select multiple cells before you run the macro, then it only uses the background color from the first cell in your selection.

Now you can select any other cells you want and run the ApplyColor macro. It takes the value stored in lbgc and applies it to the background in every cell you selected.

If you assign shortcut keys to these macros (or add them to your Quick Access Toolbar), then you can easily copy background shading from one cell to any number of other cells you desire.

As I said, these macros deal only with background color because that was the issue being faced by Barry. There are other table cell formatting elements that could be saved and copied using the same technique—just define the storage variables outside of the macros, save the values in the SetColor macro, and then apply the values in the ApplyColor macro.

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 (12881) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

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

Creating Charts in VBA

Most charts you create in Excel are based on information stored in a worksheet. You can also create charts based on ...

Discover More

Understanding ASCII and ANSI Characters

Two of the most common character coding schemes used in computers go by the acronyms ASCII and ANSI. This tip explains a ...

Discover More

Printing Shortcut Key Assignments from a Macro

Need to know what shortcut keys are defined? You can use a single macro command line to print out the definitions.

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

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

Discover More

Adding Diagonal Borders

Want to add a border diagonally, through the middle of a table cell? It's easy if you follow the formatting steps ...

Discover More

Adjusting Table Row Height

When working with tables, you can adjust the height of individual rows. How you go about such adjustments depends on the ...

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 four minus 0?

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