Sorry Linda, I think I lost track of the original thread (past my bedtime is
my only excuse).
Anyways, now I think I know what you want. My original CF was correct, just
limited. This is hopefully now correct, and not limited. we'll see...
Same as before, worksheet event code in the sheet module. It caters for 5
heavenly bodies, extend as required
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColour As Long
Dim cell As Range
Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("E2")) Is Nothing Then
With Target
Select Case LCase(Target.Value)
Case "mars": iColour = 3 'Red
Case "moon": iColour = 5 'Blue
Case "sun": iColour = 6 'Yellow
Case "saturn": iColour = 10 'Green
Case "venus": iColour = 45 'orange
End Select
For Each cell In Range("A3:H9")
If cell.Value = .Value Then
cell.Interior.ColorIndex = iColour
Else
cell.Interior.ColorIndex = xlColorIndexNone
End If
Next cell
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Just one thing confusing me now (such clear-headedness(sic!)), if there can
only be one set of values highlighted, as there is only one source value
(E2), why do you need different colours, I would have thought that as the
text differs, only one colour would be needed (just thought why mightwant
different colours, but try this first and see how we get on).
Forgive me if you post back and I don't reply tonight (this
evening/afternoon/morning - whatever it is in your part of the world), but I
must sleep, I will get to it tomorrow.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
Linda for Bob said:
LOL, I apologize for being unclear Bob. Let me try again.
I would like to type the name of a planet, in one location say, E2. My
active worksheet already contains a table listing all the planets during the
days of the week (sample below). I would like the program to search the
active worksheet for the planet i have entered in cell E2, when it finds it,
I would like it to be highlighted in a specific color.
The table looks like this:
Sunday Monday Tuesday Wednesday Thurs Fri Sat
Sun Moon Mars Mercury Jupiter Venus Saturn
Mercury jupiter Venus Sun Moon Saturn
Mars