none
vba find last data row from first contiguous block of data RRS feed

  • Question

  • If for example I have a column that contains data from rows 2 to 30 and row 32 of that same column is a totals cell, how can I get the last row of data not including the total? In this case should return 30. Thanks
    Tuesday, July 24, 2018 5:49 PM

Answers

  • For example, for column D:

    Range("D2").End(xlDown) is the last non-blank cell moving down from D2. So Range("D2").End(xlDown).Row is the row number of that cell.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by James N San Thursday, July 26, 2018 1:31 PM
    Tuesday, July 24, 2018 9:16 PM

All replies

  • For example, for column D:

    Range("D2").End(xlDown) is the last non-blank cell moving down from D2. So Range("D2").End(xlDown).Row is the row number of that cell.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by James N San Thursday, July 26, 2018 1:31 PM
    Tuesday, July 24, 2018 9:16 PM
  • great thanks
    Thursday, July 26, 2018 1:32 PM