Well I guess it makes sense to use something you understand so you can edit it/reuse it in future.
I've never been very good at explaining things, but this is what my code does.
Cells(Rows.CountLarge, 1).End(xlUp).Row
This is finding the last cell in Column A that is not blank and gets the row number. So if I had values in A1 to A10 the first line becomes:
For r = 1 To 10
This tells the For loop to start at one, and then repeat the loop adding 1 each time, then stop at 10.
IIf(Cells(r, 1).Value > Cells(r, 2).Value, Cells(r, 1).Value, "")
IIf(Cells(r, 1).Value > Cells(r, 2).Value, Cells(r, 1).Value, "")
IIf(Expresion, True, False)
This is basically like the Excel formula "=IF(....". So you put the expression you want to test first, then True is what it returns if the expression is True. (In our case we want to return the value in Column 1 of the Row we are checking. If False I have just returned an empty string.)
Hope this helps.
Bookmarks