View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JVANWORTH JVANWORTH is offline
external usenet poster
 
Posts: 50
Default VBE Expert Help, Code linked to Cells

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


"JVANWORTH" wrote:

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 its 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