G
Guest
Can Code be linked to cells?
Mike H graciously created this code to change cell colors per my question
which follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:G10")) _
Is Nothing Then Exit Sub
Select Case Target.Value
Case "A" To "E"
icolor = 3
Case "F" To "J"
icolor = 41
Case "K" To "O"
icolor = 4
Case "P" To "T"
icolor = 6
Case Else
End Select
Target.Interior.ColorIndex = icolor
End Sub
I need to take this one step further. I have four list of high school
classes that I need to extend this to. I can type in each class (60 plus)
and assign a color in the code.
OR…..can I link the code to the list so it runs thru the list and matches
color. I my need to change/refresh the list once in a while.
Let me know if more info is needed.
Thanks
John
Mike H graciously created this code to change cell colors per my question
which follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:G10")) _
Is Nothing Then Exit Sub
Select Case Target.Value
Case "A" To "E"
icolor = 3
Case "F" To "J"
icolor = 41
Case "K" To "O"
icolor = 4
Case "P" To "T"
icolor = 6
Case Else
End Select
Target.Interior.ColorIndex = icolor
End Sub
JVANWORTH said:I need a cell to change into four (4) different colors if a specific
condition is met. For example if A1 matches a text value “A thru E†I need
“redâ€, if it’s a “F thru J†then “blueâ€, “K thru O†then “greenâ€, “P thru Tâ€
then yellow.
I need to take this one step further. I have four list of high school
classes that I need to extend this to. I can type in each class (60 plus)
and assign a color in the code.
OR…..can I link the code to the list so it runs thru the list and matches
color. I my need to change/refresh the list once in a while.
Let me know if more info is needed.
Thanks
John