cell color

  • Thread starter Thread starter bluejay
  • Start date Start date
B

bluejay

In EXCEL, I want to change the cell color to reflect the text value. Like if
the cell contains "John", I want the cell color to be green, if "Bob", the
cell color to be Blue, if "Frank", purple, if "Joe", red, etc. I want to be
able to display about 18 different colors. Conditional Formatting has a
limitation of three if conditions. Thanks for your help.
 
bluejay said:
In EXCEL, I want to change the cell color to reflect the text value. Like if
the cell contains "John", I want the cell color to be green, if "Bob", the
cell color to be Blue, if "Frank", purple, if "Joe", red, etc. I want to be
able to display about 18 different colors. Conditional Formatting has a
limitation of three if conditions. Thanks for your help.
Have you tried "if"?
 
Sub colourme18x()
For Each cell In Range("a1:a555")
If cell.Value = "fred" Then cell.Interior.ColorIndex = 35
If cell.Value = "bob" Then cell.Interior.ColorIndex = 37
If cell.Value = "frank" Then cell.Interior.ColorIndex = 39
Next
End Sub

continue to suit and adjust range where needed, record a macro if you to, to
get colour codes
cheers
Pete
 
You can use cell conditional formatting

condition1: Cell Value is Equal To John
then select the Format Color

Add >> conditions to suit
 
Back
Top