Re revised macro: Max & min values highlighted by font colour.
This macro refers to a previous post on 05-10-2011 Max & min values highlighted by font colour the problem was solved but the data has been moved to new cell locations and i would like to know if Is it possible to modify the revised macro to reflect revised column numbers and additional columns to be highlighted for max and min values
.A B C D E f-g T -AF ag-ai AJ AK AL AM AN
date sad name course time
The changes from the original spreadsheet (where the range was p2:w2 are an additional heading added and these headings are now moved to cols A-E,cols f to g and ag to ai contain no data for highlighting.Cols T to AF and AJ to AN contain ratings to be highlighted as per the original query
Set Rng = Rng.Resize(RowSize:=RngEnd.Row - Rng.Row + 1)
Application.ScreenUpdating = False
StartRow = 1
For R = 1 To Rng.Rows.Count
GroupName = Rng.Item(R, 1) & Rng.Item(R, 3) & Rng.Item(R, 4)
NextName = Rng.Item(R + 1, 1) & Rng.Item(R + 1, 3) & Rng.Item(R + 1, 4)
If GroupName <> NextName Then
Set GroupRng = Rng.Item(StartRow, 5).Resize(R - StartRow + 1, 4)
For I = 1 To 4
MinRate = WorksheetFunction.Min(GroupRng.Columns(I))
MaxRate = WorksheetFunction.Max(GroupRng.Columns(I))
For J = 1 To GroupRng.Rows.Count
Select Case GroupRng.Item(J, I)
Case MinRate
GroupRng.Item(J, I).Font.Color = vbGreen
Case MaxRate
GroupRng.Item(J, I).Font.Color = vbRed
End Select
Next J
Next I
StartRow = R + 1
End If
Next R
Application.ScreenUpdating = True
End SubAttached Files Color Min and Max Values ver 1a.xls (35.5 KB, 4 views)
_________________
Many thanks for any help
Bookmarks