S
Simon Lloyd
Hi all, I am trying to get cells in a certain range to change colou
depending on their content, i need to check for a name and any othe
word in the cell i.e Cheryl Home where home could be a variable (als
it shouldnt matter what case it is in) then when it finds the name an
variable change the cells colour and leave only the variable visible i
the cell!
Here's what i have so far it doesn't quite work!
Dim mycell
Dim rng As Range
Set rng = Range("B4:M46")
For Each mycell In rng
If mycell = "" Then
Exit Sub
ElseIf mycell.Value = "Cheryl" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
If mycell.Value = "Emma" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
If mycell.Value = "Lauren" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next
Hope you can help!
Reagrds
Simo
depending on their content, i need to check for a name and any othe
word in the cell i.e Cheryl Home where home could be a variable (als
it shouldnt matter what case it is in) then when it finds the name an
variable change the cells colour and leave only the variable visible i
the cell!
Here's what i have so far it doesn't quite work!
Dim mycell
Dim rng As Range
Set rng = Range("B4:M46")
For Each mycell In rng
If mycell = "" Then
Exit Sub
ElseIf mycell.Value = "Cheryl" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
If mycell.Value = "Emma" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
If mycell.Value = "Lauren" & "*" Then
mycell.Select
End If
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Next
Hope you can help!
Reagrds
Simo