Last row detection

Last row detection lets a macro adapt to a variable amount of data. You go up from the bottom of the sheet with Cells(Rows.Count, 1).End(xlUp).Row, which returns the last non-empty cell of a column. Coding a fixed bound makes new rows ignored or empty rows processed.

Example

derniere = Cells(Rows.Count, 1).End(xlUp).Row

Related concepts

The whole glossary