How to set cell color equal to another cell color in Excel?
If you want to match a cell color to another, a method in this article can help you.
The below VBA method can help you set a cell color equal to another in Excel. Please do as follows.
1. In the worksheet you need to match the color of two cells, please right click the sheet tab, and then click View Code from the right-clicking menu. See screenshot:
2. In the opening Microsoft Visual Basic for Applications window, you need to copy and paste VBA code into the Code window.
VBA code: Set cell color equal to another cell color
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Me.Range("C1").Interior.Color = Me.Range("A1").Interior.Color End Sub
Note: In the code, A1 is the cell contains the fill color you will match to C1. Please change them based on your needs.
Then the cell C1 is filled with the same color of cell A1 as below screenshot shown.
From now on, when fill color in A1 is changed, C1 will be matched with the same color automatically.
- How to make sheet tab name equal to cell value in Excel?
- How to change value based on cell color in Excel?
- How to change cell color when cell is clicked or selected in Excel?
Best Office Productivity Tools
Supercharge Your Spreadsheets： Experience Efficiency Like Never Before with Kutools for Excel
Kutools for Excel boasts over 300 features, ensuring that what you need is just a click away...
Supports Office/Excel 2007-2021 & newer, including 365 | Available in 44 languages | Enjoy a full-featured 30-day free trial.
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!