How to automatically link a cell color to another in Excel?
While using Microsoft Excel, do you know how to link a cell color to another automatically? This article will show you method to achieve it.
Supposing you want to link the fill color of cell A1 to C1, when changing the fill color of A1, the color of C1 will turn to the same automatically. Please do as follows.
1. Right click the sheet tab you need to link a cell color to another, and then click View Code from the right-clicking menu.
2. In the opening Microsoft Visual Basic for Applications window, please copy and paste the below VBA code into the Code window.
VBA code: Auto link a cell color to another in Excel
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Me.Range("C1").Interior.Color = Me.Range("A1").Interior.Color End Sub
Note: you can change the cells reference in the code as you need.
3. Go ahead to press the Alt + Q keys at the same time to close the Microsoft Visual Basic for Applications window.
From now on, when changing the fill color of cell A1, the fill color of cell C1 will be changed to the same color automatically.
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!