I have this code modified for my needs. But I am wondering how can this be restricted to particular cell range? for Eg., Cell L10 to L200
Thanks.
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 "Not Started"
Cell.Interior.ColorIndex = 3
Cell.Font.Bold = False
Case "Completed"
Cell.Interior.ColorIndex = 4
Cell.Font.Bold = False
Case "On Hold"
Cell.Interior.ColorIndex = 5
Cell.Font.Bold = False
Case "In Progress"
Cell.Interior.ColorIndex = 6
Cell.Font.Bold = False
Case "Not Applicable"
Cell.Interior.ColorIndex = 16
Cell.Font.Bold = False
Case Else
Cell.Interior.ColorIndex = xlNone
Cell.Font.Bold = False
End Select
Next
End Sub
Thanks.
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 "Not Started"
Cell.Interior.ColorIndex = 3
Cell.Font.Bold = False
Case "Completed"
Cell.Interior.ColorIndex = 4
Cell.Font.Bold = False
Case "On Hold"
Cell.Interior.ColorIndex = 5
Cell.Font.Bold = False
Case "In Progress"
Cell.Interior.ColorIndex = 6
Cell.Font.Bold = False
Case "Not Applicable"
Cell.Interior.ColorIndex = 16
Cell.Font.Bold = False
Case Else
Cell.Interior.ColorIndex = xlNone
Cell.Font.Bold = False
End Select
Next
End Sub