[Solved] VBA: For Loop to find maximum value in a column


To get the corresponding value in Column C where column A is max:

dim t as long
dim rslt as string
With Worksheets("RESOURCE") ' Change to your sheet
    t = Application.WorksheetFunction.Match(Application.WorksheetFunction.Max(.Range("AX6:AX29")),.Range("AX6:AX29"),0)
    rslt = .Range("A6:A29")(t)
    Debug.Print rslt
End With

enter image description here


But this can be done with the following formula on the sheet:

=INDEX(RESOURCE!A6:A29,MATCH(MAX(RESOURCE!AX6:AX29),RESOURCE!AX6:AX29,0))

enter image description here

2

solved VBA: For Loop to find maximum value in a column