Change Text Color in one cell based upon entry in referenced cell

T

Tee

I have a row of 21 cells in column A. I have a row of 21 cells in column B.

I want column A4 to change text color based upon number entry into B4.

For instance, if I enter the number 1 into B4, I would like cell A4 text to
change to red.

For instance, if I enter the number 2 into B5, I would like cell A5 text to
change to blue.

I can't use conditional formatting b/c it only gives me up to three
conditions. I need 21 conditions.

Thanks in advance for your help!

Tee
 
S

Sheeloo

You will have to use a Macro to do this.

You will need to loop through the cells in Col B and upate the
Interior.ColorIndex property of Cell in Col A based on the value in Col B.
Following will color cells A1, A2 and A3 with Yellow, Red, and Green.

Sub ColorCells
Range("A1").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Range("A2").Select
With Selection.Interior
.ColorIndex = 46
.Pattern = xlSolid
End With
Range("A3").Select
With Selection.Interior
.ColorIndex = 43
.Pattern = xlSolid
End With
End Sub
 
G

Gord Dibben

You need only one condition for each cell if I read your decription
properly.

A4 condition would be =B4=4 format as red

A5 condition would be =B5=5 format as blue


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top