Highlighting the 5 Largest Numbers in a list
If you want the first 5 UNIQUE largest numbers then try this:
Sub b()
Dim Cell As Range
lr = Cells(Rows.Count, "e").End(xlUp).Row
Set rng = Range("e2:e" & lr + 200)
rng.Interior.ColorIndex = 0 ' clear beyond last
Set rng = Range("e2:e" & lr)
i = 1
For j = 1 To 5
With rng
Set c = .Find(Application.Large(rng, i), LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
n = Application.CountIf(rng, Application.Large(rng, i))
Do
c.Interior.ColorIndex = j + 3
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
i = i + n
Next j
End Sub
" wrote:
Hi all,
I have a Score column that runs into many entries.
Is there a way to highlight the top 5 scores on the list in different
colours.
Conditional format permits me to highlight the three largest only (yes
another gripe on this much needed excel feature!)
Any help is appreciated in advance!!
Regards
Manosh
|