Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Replacing Background Colors in Cells.

Replacing Background Colors in Cells

by Allen Wyatt
(last updated December 23, 2013)

18

Jozef is looking for a way to change background colors of specific cells in the worksheet he created. For example, he would like to find all red background cells and change them to blue, or find all yellow backgrounds and change them to blue. Jozef wonders if there is an easy way to do this.

It's fairly obvious that you can change the background colors of any cells manually, so there is no need to go into that option for making the changes. What you need to do is use a simple tool, such as the Find and Replace tool, to make the color changes. Follow these steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Expand the dialog box by clicking the Options button. (See Figure 1.)
  3. Figure 1. The Replace tab of the Find and Replace dialog box.

  4. Click the Format button at the right side of the Find What box. Excel displays the Find Format dialog box.
  5. Make sure the Fill tab is selected. (See Figure 2.)
  6. Figure 2. The Fill tab of the Find Format dialog box.

  7. Use the controls in the dialog box to specify the background color you want to replace.
  8. Click OK.
  9. Click the Format button at the right side of the Replace With box. Excel displays the Replace Format dialog box.
  10. Make sure the Fill tab is selected.
  11. Use the controls in the dialog box to specify the background color you used when changing the cells.
  12. Click OK.
  13. Click Replace All.

If you find yourself needing to make the same color changes over and over (for instance, always changing from red to blue), then you may be interested in using a macro to do the changes. The following example could be assigned to a shortcut key or added to the Quick Access Toolbar so you can use it quickly:

Sub ChangeColor()
    Dim rCell As Range
    If Selection.Cells.Count = 1 Then
        MsgBox "Select the range to be processed."
        Exit Sub
    End If
    For Each rCell In Selection
        If rCell.Interior.Color = RGB(255, 0, 0) Then  'red
            rCell.Interior.Color = RGB(0, 0, 255)      'blue
        End If
    Next rCell
End Sub

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9043) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Replacing Background Colors in Cells.

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 an Inline Heading

When settling on an overall design for your document, you need to decide how you want your headings to appear. If you want ...

Discover More

Changing the Time Zone

There are several times in Drive where the program needs to keep track of the time at which certain events occur. Here's how ...

Discover More

Removing Spaces

Need to get rid of spaces in a range of cells? There are two ways you can approach the task, as described here.

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

MORE EXCELTIPS (RIBBON)

Using Strikethrough Formatting

Need a line through the middle of your text? Use strikethrough formatting, which is easy to apply using the Format Cells ...

Discover More

Creating a Center Across Selection Button

The ability to center text across a range of cells has long been a staple of experienced Excel users. Here's how to create a ...

Discover More

Flashing Cells

Want to draw attention to some information in a particular cell? Make the cell flash, on and off. Here's how you can ...

Discover More
Subscribe

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

View most recent newsletter.

Comments for this tip:

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 7 + 8?

2016-09-23 20:11:34

Peter

Jay

I tried this and it works.

Sub ChangeColour()
Dim rng2Colour As Range

Set rngRef = Selection(1)
InteriorColour = Selection(1).Interior.Color
Set rng2Colour = Selection

rng2Colour.Interior.Color = InteriorColour

End Sub

The ref cell was selected first the pressing ctrl i selected the range to colour and press run.

Should be quicker, no looping.

hth


2016-09-21 16:48:19

Jay Grace

I am trying to change the fill color of any cell that have a light peach color to a darker peach color. I highlighted the column first. The problem is I get the following error:

"Microsoft Office Excel cannot find any data to replace. Check if your search formatting and criteria are defined correctly."

I copied the formatting from one of the original cells in both format boxes and only changed to a darker color.


2016-08-24 09:41:21

Amy

Christine & Julie - I had the same problem. Try checking the box "Match entire cell contents". This worked for me.


2016-05-21 03:58:45

Norman

Thanks for the information. It worked perfectly.


2016-04-07 13:27:52

MorrisGunn

This only replaces the color for empty cells, how do you find cells with data and replace them with the same data?


2016-01-29 09:19:10

Sarah

FINALLY - A simple solution with the find and replace. I just wanted to add a value to shaded cells so that I create a chart. After foaming at the mouth with lots of macro instructions, the find and replace worked perfectly.
Thanks


2015-11-04 09:26:48

Bryan

Thank you VERY MUCH this was a perfect fix for me. I work on changes to sheets with over 50,000 cells and this tip has saved me hours! Thank you again for taking the time to share!


2015-10-08 17:24:15

Chrisinte

replacing fill color is not working. I keep getting the message that it cannot find any cells with this color -- and my spreadsheet it loaded with this particular color. I even "choose format from cell". And it still can't find it! I even manually changed some of the cells to a different color fill and then tried to replace the new color -- and still it said it could not find anything to replace.


2015-08-17 10:33:04

shinto

is there any option to find a set of numbers in excel. for example

1 5 3 7 9
3 4 6 7 8
4 6 8 9 2
66 75 23 14 15

if i want to find the combination 1 5 3 7 9 what should i do? is there any way to find the same set of number which is in a different order ie 5 1 9 7 3? please help me?


2015-05-06 09:41:36

wanda

I'm looking for a way to change the color or add a boarder of the selected cell when using. For example; when I'm searching a large spreadsheet its difficult to see which box is highligted


2014-09-24 04:39:47

dorothy

hello good afternoon, i would like to ask how to hyperlink the background color inorder for me to when i click the color and click another tab the color will change


2014-07-21 15:02:16

Julie

This worked like a charm and suddenly it has stopped working. I've tried to use it on multiple spreadsheets and it can never find what I'm looking for. I'm even using the "choose format from cell" option and same thing. I know there's probably something simple that I'm missing but I'm stumped.


2014-03-26 07:00:52

Bryan

pradeep: this is not a bug. Conditional formatting is not the same as underlying cell formatting. Otherwise, you would not be able to apply both to a cell at the same time. Allen's tip only works for the latter type of formatting.

Besides, if you want to change all the cells that are conditionally-formatted to be red to instead be blue, just use the conditional format dialogue. It's just as easy as find/replacing the colors.


2014-03-26 00:10:34

pradeep

Bug in excel 2010:
Does not work when you apply format through conditional formatting. Then try to choose the format for find/replace.


2014-03-10 09:42:11

Nichole

This doesn't work for me. Every time I try, it tells me that excel can't find what I'm looking for. And I've double checked the colors I'm trying to find and everything.


2014-01-16 01:24:08

Joty

Clearly laid out and easy to follow, many thanks.


2014-01-08 04:24:11

Strid

I have already searched for this. Thank you!


2014-01-07 10:25:37

Beccy

Thank you for this. It couldn't have been more clearly and simply set out and I found it very useful.


Newest Tips
Subscribe

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.

Links and Sharing
Share