Can anyone tell me why this code doesn't work?
I used this same code w/ numbers instead of letters and it worked. = Cells fill with appropriate color base on value entered.
Thanks,
Jim
I used this same code w/ numbers instead of letters and it worked. = Cells fill with appropriate color base on value entered.
Thanks,
Jim
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Dim Rng1 As Range
On Error Resume Next
Set Rng1 = ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas, 1)
On Error GoTo 0
If Rng1 Is Nothing Then
Set Rng1 = Range(Target.Address)
Else
Set Rng1 = Union(Range(Target.Address), Rng1)
End If
For Each Cell In Rng1
Select Case Cell.Value
Case vbNullString
Cell.Interior.ColorIndex = xlNone
Cell.Font.Bold = False
Case 0
Cell.Interior.ColorIndex = 9
Cell.Font.Bold = True
Case MA
Cell.Interior.ColorIndex = 38
Cell.Font.Bold = True
Case IN
Cell.Interior.ColorIndex = 15
Cell.Font.Bold = True
Case AD
Cell.Interior.ColorIndex = 39
Cell.Font.Bold = True
Case SC
Cell.Interior.ColorIndex = 37
Cell.Font.Bold = True
Case OC
Cell.Interior.ColorIndex = 35
Cell.Font.Bold = True
Case PM
Cell.Interior.ColorIndex = 27
Cell.Font.Bold = True
Case Else
Cell.Interior.ColorIndex = xlNone
Cell.Font.Bold = False
End Select
Next
End Sub
Last edited by a moderator: