Automatically Changing a Cell's Background Color

Written by Allen Wyatt (last updated July 3, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365

Jim wrote in, asking how to automatically change the background color of cell A1 on Sheet2 to match the background color of cell A1 on Sheet1 if the background color of cell A1 on Sheet1 changes.

The answer to this question depends on whether the Sheet1!A1 cell is changing color because of conditional formatting or if the color is changing because the user is explicitly changing the color.

Believe it or not, if the color change is the result of conditional formatting, then the answer is easy—all you need to do is add a conditional formatting rule to the Sheet2!A1 cell that is essentially the same as the rule used for the Sheet1!A1 cell. The only potential difference is that your rule for Sheet2!A1 may need to include worksheet references, such as those being used in this paragraph.

If the color of Sheet1!A1 is changing because the user if making the change, then you need to resort to using a macro. Unfortunately, there is no workbook or worksheet event that can handle color changes in a cell. You can, however, create an event handler that will execute whenever the user makes Sheet2 active. (This makes sense; the user can only see what is in cell A1 in that sheet when the sheet is made active.) Here's an example event handler that can be added to the code sheet for Sheet2:

Private Sub Worksheet_Activate()
    Dim rSource As Range

    Set rSource = Worksheets("Sheet1").Range("A1")
    Range("A1").Interior.Color = rSource.DisplayFormat.Interior.Color
End Sub

Interestingly enough, this macro will work even if the color of Sheet1!A1 is being affected by a conditional formatting rule. The secret is the use of the DisplayFormat object, which represents the format as it is displayed, rather than as it is explicitly formatted.


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

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13879) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

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


Double-Spacing Your Document

Need to produce a quick double-spaced printout of your document? You can do it by using the simple steps in this tip.

Discover More

Declaring Variables

Macros depend on the use of variables to do their work. This tip examines how variables are declared in a macro, using ...

Discover More

Determining If a Cell is Bold

Want to figure out if the text in a cell is bold? The best approach is to use your own user-defined function, as ...

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

Drawing Borders

Adding borders around cells is a common formatting task. You can make the task more intuitive by actually drawing the ...

Discover More

Wrapping Text in Merged Cells

When you are formatting your worksheet, Excel lets you easily merge adjacent cells together. If you want to wrap the text ...

Discover More

Changing to a Non-US Date Format

Do you want to specify your months and days differently when displaying dates in your worksheets? This tip looks at how ...

Discover More

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

View most recent newsletter.


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 eight more than 2?

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 Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, 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.