(Solved) – Change Backcolor of Excel Cells in Range with Highest Value


So this code gets the highest value of a cell in a range. But what I’m trying to do is change the back color of the cells to yellow with the highest value. Any suggestions?

Dim rng As Range
Dim dblMax As Double

'Set range from which to determine largest value
Set rng = Sheet1.Range("A1:A100")

'Worksheet function MAX returns the largest value in a range 

dblMax = Application.WorksheetFunction.Max(rng)

'Displays largest value
MsgBox dblMax

Leave a Reply

Your email address will not be published. Required fields are marked *