Hi,
I have two codes that i use to
1. Reset dependent dropdown list if value in A6 changes
2. change the cell color based on the value in the cell D6 changes.
Here are the codes i am using. Is there anyway to combine them under one code so that when values change it automatically updates.
Code to reset dependent list.
Code to change cell color based on value
I have two codes that i use to
1. Reset dependent dropdown list if value in A6 changes
2. change the cell color based on the value in the cell D6 changes.
Here are the codes i am using. Is there anyway to combine them under one code so that when values change it automatically updates.
Code to reset dependent list.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Target.Worksheet.Range("A6")) Is Nothing Then
Target.Offset(0, 1).Value = ""
Target.Offset(0, 2).Value = ""
End If
Application.EnableEvents = True
End Sub
Code to change cell color based on value
Code:
Sub Color_Change
Application.EnableEvents = False
Dim MyCell As Range
Dim StatValue As String
Dim StatusRange As Range
Set StatusRange = Range("D6")
For Each MyCell In StatusRange
StatValue = MyCell.Value
Select Case StatValue
Case "Low"
MyCell.Interior.Color = RGB(0, 176, 80)
Case "Moderate"
MyCell.Interior.Color = RGB(255, 230, 153)
Case "High"
MyCell.Interior.Color = RGB(255, 204, 204)
End Select
Next MyCell
End Sub