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 Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!