- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Automatically Link a Cell Color to Another in Excel?
In Excel, you could have changed the fill colour of cells many times using conditional formatting based on a cell value, but have you ever tried to automatically link one cell colour to another in Excel? This means that if we change the fill colour of one cell, it will automatically change the colour of other cells. We will be using the VBA application to do it. This tutorial will help you understand how we can automatically link a cell's colour in Excel.
Automatically Link a Cell Colour to Another
Here we will add the VBA code to the sheet and mention the two cell addresses in code. Let us see an uncomplicated process to see how we can automatically link one cell colour to another in Excel. We need to use the help of the VBA application in order to complete our process, as it can’t be completed with the default features of Excel.
Let us consider a new Excel sheet. Right-click on the sheet name and select View Code to open the VBA application, and then enter the programme into the textbox as shown in the below image.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'Updated By Nirmal Me.Range("C1").Interior.Color = Me.Range("A1").Interior.Color End Sub
In the program, A1 is the cell where we change the color, and C1 is the cell where the colour will be changed.
Now save the sheet as a macro-enabled template and close the vba application using the command Alt + Q; then, every time we change the fill colour of cell A1, the colour of cell C1 will be changed as shown in the below image. To add the fill color, click on the font under "Home," then on "Fill," and finally on the color.
In this tutorial, we used a simple example to demonstrate how we can automatically link a cell colour to another in Excel.
Kickstart Your Career
Get certified by completing the courseGet Started