Hi,
in the attached file I'd like the code to find the max value in a range and highlight it. I'd also like to highlight only the first occurrence, the value in B107.
What's wrong with the code?
Hope someone can help me with this
Thank you
in the attached file I'd like the code to find the max value in a range and highlight it. I'd also like to highlight only the first occurrence, the value in B107.
What's wrong with the code?
Hope someone can help me with this
Thank you
VBA Code:
Sub test()
Dim rngmax As Range
Dim maxT As Double
Dim maxrow As Integer
Set rngmax = Sheets(1).Range("B107:B150")
maxT = Round(Application.WorksheetFunction.Max(rngmax), 2)
maxrow = rngmax.Find(maxT, , xlValues).Row
Sheets(1).Range("B" & maxrow).Interior.ColorIndex = 45
End Sub