Macro- max value

J

Joyce

Can anyone tell me the VB code for finding the maximun
value in a column and highlight it in red? I have to put
it in Macro.

Thanks!
 
J

Jason Morin

Try something like:

Sub FindMax()
Dim maxno As Long
Dim maxrow As Long
Set rng = Range("A:A")
maxno = Application.WorksheetFunction.Max(rng)
maxrow = rng.Find(What:=maxno).Row
With Cells(maxrow, "A")
.Font.ColorIndex = 3
.Font.Bold = True
End With
End Sub

To use it, press ALT+F11, go to Insert > Module, and paste
in the code. Then run the macro in Excel.

HTH
Jason
Atlanta, GA
 
D

Don Guillett

One way

Sub hiliteit()
columns(1).interior.colorindex=0' to clear
Columns(1).Find(Application.Max(Columns(1))) _
..Interior.ColorIndex = 6
End Sub
 
Top