Changing Cell Fill Colour

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I have a sheet where I enter different codes into the
cell. What I would like to do is when I enter a code the
cell background changes colour. There could be up to 10
codes so if I entered "AL" into a cell the background
could be RED or if I change the code to an "S" the cell
could be BLUE.
Is this possible?

All help appreciated

Nick
 
Thanks Bob
Does everyone who uses this worksheet need to have the
addin or does it stay with the sheet.
Hope this makes sense.

Nick
 
Use a worksheet_event with select case to change your format,something like
this.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
With Target
Select Case Target.Value
Case Is >= 76
.Interior.ColorIndex = 3 '(red shade)
Case Is >= 52
.Interior.ColorIndex = 4 '(green shade)
Case Is >= 26
.Interior.ColorIndex = 46 '(orange shade)
Case Is >= 11
.Interior.ColorIndex = 41 '(blue shade)
Case Is >= 6
.Interior.ColorIndex = 6 '(yellow shade)
End Select
End With
End If
End Sub
 
Yes, that is a 'feature' of the addin, as it uses event code embedded in the
addin.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top