I have a large data set with multiple sheets each with 40k+ values. I have written a macro loop to get the maximum for each column and need to get the row where that value occurs. Macro is as follows:
For n = 1 To numyears
Cells(4 + n, 1).Value = n
Cells(4 + n, 3).Value = Worksheets(SheetPtr).Cells(2, n + 2)
Cells(4 + n, 4).Value = WorksheetFunction.Max(Worksheets(SheetPtr).Columns(n + 2))
Next n
For n = 1 To numyears
Cells(4 + n, 1).Value = n
Cells(4 + n, 3).Value = Worksheets(SheetPtr).Cells(2, n + 2)
Cells(4 + n, 4).Value = WorksheetFunction.Max(Worksheets(SheetPtr).Columns(n + 2))
Next n