Conditional Formating with VBA help needed

  • Thread starter Thread starter Christian P
  • Start date Start date
C

Christian P

Hello all,

This is the first time i post here and first experience in Exce
programming, i have basic knowledge in VBA for access tho.

I am making worksheets that will be calendar.

Each worksheets are for individual months.

We will use it to see wich guy is where that day IE: annual leaves
sick leaves, on a course, out for inspection etc...

What i want it to do is that if in a cell lets say 4 jan for joe blo
we enter the letter A (for annual leave) the background will switch t
red. I know i can do that with conditional formatting but it is limite
to only 3 conditions, and i will have more options then that.

A for Annual
S for sick
C for course
I for inspection
ect....

Thanx for help.

Chri
 
Use a select case macro that is automatic. Modify to suit
right click sheet tab>view code>insert this>SAVE

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row > 4 And Target.Column = 1 Then
Select Case Target.Value
Case "A"
Target.Interior.ColorIndex = 5
Case "S"
Target.Interior.ColorIndex = 6
Case "C"
Target.Interior.ColorIndex = 7
Case "I"
Target.Interior.ColorIndex = 8
Case Else
Target.Interior.ColorIndex = 0
End Select
End If
End Sub
 
Back
Top