Match(x, r, 0)
Set r = Range(Cells(k, 1), Cells(k + 3, 1))
in the fisrt loop r is A1 to A4
x is the maximum of r
match function finds out the row no. in r of the value x
(o the third argument in match function is getting exact value)
then if find out the value of B in that row.
In the subsequent loops there is a small problem when you come to A5 to A8 it will only find the row no. within that range namely A5 to A8 . but what we want the the row number of the overall A range. so that addition of k-1 in the
I hope I made it clear. see help under match in the worksheet. then do some experiments. you will get the hand of it. I am happy you do not want to blindly copy the macro and use it. You want to find out the logic. That will help you to write macros. greetings for happy new year. If you have doubts post back.