View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Evans9939
 
Posts: n/a
Default Increasing Conditional Formatting from 3 to 5

Thank you

I added in your code as instructed and amended the cell details, the
spreadsheet stayed blank, I changed them round to see if it would make a
difference - but again nothing. What am I doing wrong?

Cathy

"CLR" wrote:

Here's some modified code from an old Frank Kabel post. It assumes your
"other set of numbers" is in E1:E5 and the ones you want to match to them are
in A1:A5........of course those ranges and the colors can be modified as
needed.


Private Sub Worksheet_Change(ByVal Target As Range)
' this has to go in your worksheet module:
' right-click on your tab name and choose 'code' in the context menu
' paste your code in the appearing editor window
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A5")) Is Nothing Then Exit Sub
On Error GoTo CleanUp:
With Target
Select Case .Value
Case Is = Range("e1").Value: .Interior.ColorIndex = 4
Case Is = Range("e2").Value: .Interior.ColorIndex = 5
Case Is = Range("e3").Value: .Interior.ColorIndex = 6
Case Is = Range("e4").Value: .Interior.ColorIndex = 7
Case Is = Range("e5").Value: .Interior.ColorIndex = 8
End Select
End With
CleanUp:
Application.EnableEvents = True
End Sub


Vaya con Dios,
Chuck, CABGx3



"Evans9939" wrote:

Hi

I need to set conditional formatting on 5 numbers to highlight any that
match another set of 5 numgers that will change week on week (lottery
numbers). I can set the conditional formatting to highlight any that match
the first 3 numbers, but not the next two.

Is there any way you can increase the conditions from 3 to 5?

Thanks Cathy