hughhuyton
New Member
- Joined
- Dec 11, 2016
- Messages
- 16
I have this code that runs through each cell of a range and then highlights the highest value in yellow. How would I incorporate a loop to have it loop through each row of the range for it to highlight the maximum value in each row.
Code:
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px}</style>Private Sub HighestValue()
Dim cell As Range
For Each cell In ActiveSheet.Range("A1:U1")
If cell.Value = Application.WorksheetFunction.Max(Range("A1:U1")) Then
cell.Interior.ColorIndex = 6
Else
cell.Interior.ColorIndex = xlNone
End If
Next
End Sub