Changing a cell color based on the color of a different cell.

lazerunicorn

New Member
Joined
Aug 17, 2008
Messages
5
I tried conditional formatting..but it doesn't seem to work.

In my worksheet there is a field that allow users to select a color by changing the color of a cell.

What i want is, a different cell to change it's color corresponding to that cell.

Example: if A1 is red B2 must also be red. But if A1 changes its color to say..blue, then B2 must also be blue.

thanks for all your help thx in advance
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello lazerunicorn, welcome to thew board.
One way might be to use the sheet selection change event, like so.
Right click the tab for the sheet of interest & paste this into the sheet module.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
[B2].Interior.ColorIndex = [A1].Interior.ColorIndex
End Sub

There are other ways (or events) that would work, but this might be all you need.

Hope it helps.
 
Upvote 0
Hello lazerunicorn, welcome to thew board.
One way might be to use the sheet selection change event, like so.
Right click the tab for the sheet of interest & paste this into the sheet module.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
[B2].Interior.ColorIndex = [A1].Interior.ColorIndex
End Sub
There are other ways (or events) that would work, but this might be all you need.

Hope it helps.

ohk i get it. what if it's on 2 diff sheets? what if it is A1 in sheet 1 and B2 in sheet 2? how would i do that?
 
Last edited:
Upvote 0
Oh, that would just be a minor change in the code. (To reference the different sheet.)
You would want to use this instead:
Code:
Sheets("Sheet2").Range("B2").Interior.ColorIndex = [A1].Interior.ColorIndex

Note that the code goes into the sheet code module for sheet1 and therefore change in sheet 2
will occur upon a selection change in sheet1

Hope it helps.
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top