Auto fill color change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I get a cell to change the color fill automatically when specific data
is entered into a cell?

I am trying yo build a calender for the company emeployees to fill out their
vacation schedules. When they enter "V" into a cell, I would like that cell
to automatically change to a dark blue fill with white text.
 
Sorry .... I need to expand on this thought. I figured out how to get a cell
to change for one variable with conditional formatting, however I have 5
possible variables of which I would like different colors for each. Can this
be done?

So for "V" I get a Dark blue fill, "H" I get another color and "A" I get
another color and so on.
 
I appreciate your quick response!! the only problem I see with this is that
everybody must have it installed in order for it to work. That isn't a
possibility at work because we are not allowed to install any type of
software. Is there another solution?
 
Dave

How about some VBA event code behind the worksheet?

Right-click on sheet tab and "View Code". Copy/paste into that module.
Adjust to suit.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("D:D"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub


Gord Dibben 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

Back
Top